DenReg/registry/src/http.ts

28 lines
638 B
TypeScript
Raw Normal View History

2020-07-29 18:47:36 +00:00
/// <reference path="./types/jsx.d.ts" />
2020-07-28 12:39:54 +00:00
import { ABC, CorsMW, LoggerMW } from "./deps.ts";
import config from "./config.ts";
const port = config?.api?.port || 8000;
const app = new ABC.Application();
app.use(LoggerMW.logger({}));
app.use(CorsMW.cors({}));
import api from "./http/api.ts";
api(app.group("api"));
import raw from "./http/raw.ts";
raw(app.group("raw"));
2020-07-29 18:47:36 +00:00
import view from "./http/views.ts";
view(app.group("/"));
import render from "./renderer.tsx";
app.renderer = {
render: render,
};
2020-07-28 12:39:54 +00:00
app.start({ port });
console.log("Running server at http://0.0.0.0:" + port);
console.log("Open at http://127.0.0.1:" + port);