You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
456 B
TypeScript
24 lines
456 B
TypeScript
import Koa from "koa";
|
|
import Static from "koa-static";
|
|
import Router from "@koa/router";
|
|
import { resolve } from "path";
|
|
import mount from "koa-mount";
|
|
|
|
const app = new Koa();
|
|
|
|
const router = new Router();
|
|
|
|
router.get("/api", (ctx) => {
|
|
ctx.body = "THIS IS API RESPONSE";
|
|
});
|
|
|
|
app.use(router.routes());
|
|
|
|
app.use(mount("/", Static(resolve(__dirname, "../public"))));
|
|
|
|
const port = 3000;
|
|
|
|
app.listen(port);
|
|
|
|
console.log(`Listening on 127.0.0.1:${port}`);
|