Type editor and schema viewer. Poppables and help icon
This commit is contained in:
24
warstone-web-service/main.ts
Normal file
24
warstone-web-service/main.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import { CGGService } from 'cgg/Application.ts';
|
||||
import { Router, send } from 'oak';
|
||||
|
||||
const app = new CGGService({ prefix: '/' });
|
||||
|
||||
// app.route(new Router()
|
||||
// .get('/', ctx => ctx.response.body = 'warstone-web service')
|
||||
// );
|
||||
const ROOT_DIR = "./public/testdata", ROOT_DIR_PATH = "/public";
|
||||
|
||||
app.use(async (ctx, next) => {
|
||||
if (!ctx.request.url.pathname.startsWith(ROOT_DIR_PATH)) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
const filePath = ctx.request.url.pathname.replace(ROOT_DIR_PATH, "");
|
||||
await send(ctx, filePath, {
|
||||
root: ROOT_DIR,
|
||||
});
|
||||
});
|
||||
|
||||
app.start();
|
||||
console.log('warstone-web service running on ' + Deno.args.at(0));
|
Reference in New Issue
Block a user