This PR extracts the functionality from the `fs_routes` plugin and exposes it onto `App`. These are the new APIs: - `app.layout(pattern, route)` - `app.onError(pattern, route)` - `app.notFound(pattern, route)` - `app.route(pattern, route)` This also removes the need for `.use(staticFiles())`. This line can be safely removed. Fixes https://github.com/denoland/fresh/issues/3040 Fixes https://github.com/denoland/fresh/issues/3033 Fixes https://github.com/denoland/fresh/issues/2591 Fixes https://github.com/denoland/fresh/issues/950 Fixes https://github.com/denoland/fresh/issues/1918
19 lines
506 B
TypeScript
19 lines
506 B
TypeScript
import { type Span, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
import denoJson from "../deno.json" with { type: "json" };
|
|
|
|
export const CURRENT_FRESH_VERSION = denoJson.version;
|
|
|
|
export const tracer = trace.getTracer("fresh", CURRENT_FRESH_VERSION);
|
|
export { trace };
|
|
|
|
export function recordSpanError(span: Span, err: unknown) {
|
|
if (err instanceof Error) {
|
|
span.recordException(err);
|
|
} else {
|
|
span.setStatus({
|
|
code: SpanStatusCode.ERROR,
|
|
message: String(err),
|
|
});
|
|
}
|
|
}
|