24 lines
644 B
TypeScript
24 lines
644 B
TypeScript
|
|
import { CGGService } from 'cgg/Application.ts';
|
|
import { Router, send } from 'oak';
|
|
|
|
const prefix = ''
|
|
const app = new CGGService({ prefix: `/${prefix}` });
|
|
|
|
// app.route(new Router()
|
|
// .get('/', ctx => ctx.response.body = 'warstone-web service')
|
|
// );
|
|
const ROOT_DIR = "./project-warstone/dist";
|
|
|
|
app.use(async (ctx) => {
|
|
if (ctx.request.url.pathname.includes('favicon')) return ctx.response.status = 404;
|
|
const filePath = ctx.request.url.pathname.replace(prefix, "");
|
|
await send(ctx, filePath, {
|
|
root: ROOT_DIR,
|
|
index: 'index.html'
|
|
});
|
|
});
|
|
|
|
app.start();
|
|
console.log('warstone-web service running on ' + Deno.args.at(0));
|