12345678910111213141516171819202122 |
- import Koa from 'koa';
- import serve from 'koa-static';
- import config from './app.config.js';
- import router from './router/index.mjs';
- import { koaBody } from 'koa-body';
- const app = new Koa();
- app.use(serve(config.public));
- app.use(koaBody());
- app.use(router.routes());
- app.use(router.allowedMethods());
- app.listen(config.port, config.host, () => {
- console.info(`服务已启动,地址为:'http://${config.host}:${config.port}'.`);
- });
|