本地运行正常,放到服务器里加载不了某些文件 访问地址:http://122.114.97.88:3000/ dist/bundle.js文件加载不了,一直在转圈 http://122.114.97.88:3000/bundle.txt 改成txt也不行 http://122.114.97.88:3000/2.jpg 换成大图也工作正常!
代码如下
const path = require('path');
const app = require('koa')();
const router = require('koa-router')();
const render = require('koa-ejs');
render(app, {
root: path.join(__dirname, 'views'),
layout: 'template',
viewExt: 'html',
cache: false,
debug: true
});
app.use(require('koa-static')(__dirname + '/data'));
router
.get('/', function *(next){
yield this.render('index');
})
.get('/hello', function *(next){
this.body = 'hello!';
});
app
.use(router.routes())
.use(router.allowedMethods());
app.listen(3000);
最后感谢各位大神帮忙