12345678910111213141516 |
- const Koa = require('koa');
- const app = new Koa();
- const static = require('koa-static') //静态资源服务插件
- const path = require('path')
- // 配置静态资源
- const staticPath = '/'
- app.use(static(
- path.join( __dirname, staticPath)
- ))
- // app.use(main);
- app.on('error', (err, ctx) =>{
- console.error('server error', err);
- });
- app.listen(8082, function () {
- console.log('static-server is starting at port 8082 ')
- });
|