17 lines
424 B
TypeScript
17 lines
424 B
TypeScript
import { App, csp, csrf, staticFiles } from "fresh";
|
|
import { define, type State } from "./utils.ts";
|
|
|
|
export const app = new App<State>();
|
|
|
|
// Vite's dev client injects CSS through <style> tags without a nonce
|
|
app.use(csrf(), csp({ useNonce: !import.meta.env.DEV }));
|
|
|
|
app.use(staticFiles());
|
|
|
|
app.use(define.middleware((ctx) => {
|
|
console.log(`${ctx.req.method} ${ctx.req.url}`);
|
|
return ctx.next();
|
|
}));
|
|
|
|
app.fsRoutes();
|