Sam Therapy
86fc82dcc3
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Sam Therapy <sam@samtherapy.net>
30 lines
740 B
TypeScript
30 lines
740 B
TypeScript
import Server from "lume/core/server.ts"
|
|
import expires from "lume/middlewares/expires.ts"
|
|
import not_found from "lume/middlewares/not_found.ts"
|
|
|
|
const port = 8000
|
|
|
|
const server = new Server({
|
|
port: port,
|
|
root: `${Deno.cwd()}/dist`,
|
|
})
|
|
|
|
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.use(not_found({
|
|
root: `${Deno.cwd()}/dist`,
|
|
page404: "404.html",
|
|
}))
|
|
|
|
server.start()
|
|
|
|
console.log(`Listening on http://localhost:${port}`)
|