webzone/serve.ts
Sam Therapy 9865884fe2
Some checks failed
continuous-integration/drone/push Build is failing
Overhaul my website by just using a template
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2024-03-24 17:06:04 +01:00

24 lines
644 B
TypeScript

import Server from "lume/core/server.ts";
import expires from "lume/middlewares/expires.ts"
const server = new Server({
port: 8000,
root: `${Deno.cwd()}/_site`,
});
// Set Access-Control-Allow-Origin header to allow all origins
server.use(async (request, next) => {
// Here you can modify the request before being passed to next middlewares
const response = await next(request);
response.headers.set('Access-Control-Allow-Origin', '*')
// Here you can modify the response before being returned to the previous middleware
return response;
});
server.use(expires())
server.start();
console.log("Listening on http://localhost:8000");