You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
745 B

import { Application, send } from "https://deno.land/x/oak@v7.3.0/mod.ts";
import config from "./config/config.ts";
import router from "./api.ts";
import { bootstrapBlocks } from "./blocks.ts";
await bootstrapBlocks();
const app = new Application();
app.use(router.routes());
app.use(async (context) => {
await send(context, context.request.url.pathname, {
root: `${Deno.cwd()}/frontend/dist`,
index: "index.html",
});
});
app.addEventListener("listen", ({ hostname, port, secure }) => {
const host = hostname ?? "localhost";
const protocol = secure ? "https://" : "http://";
console.log(`Listening on: ${protocol}${host}:${port}`);
});
await app.listen({
hostname: config.server.host,
port: config.server.port,
});