app.js 434 B

12345678910111213141516
  1. const Koa = require('koa');
  2. const app = new Koa();
  3. const static = require('koa-static') //静态资源服务插件
  4. const path = require('path')
  5. // 配置静态资源
  6. const staticPath = '/'
  7. app.use(static(
  8. path.join( __dirname, staticPath)
  9. ))
  10. // app.use(main);
  11. app.on('error', (err, ctx) =>{
  12. console.error('server error', err);
  13. });
  14. app.listen(8082, function () {
  15. console.log('static-server is starting at port 8082 ')
  16. });