mirror of
https://github.com/typicode/json-server.git
synced 2025-07-30 05:31:41 +08:00
Fix default index
This commit is contained in:
@ -41,7 +41,7 @@ module.exports = function(object, filename) {
|
|||||||
if (fs.existsSync(process.cwd() + '/public')) {
|
if (fs.existsSync(process.cwd() + '/public')) {
|
||||||
server.use(serveStatic(process.cwd() + '/public'));
|
server.use(serveStatic(process.cwd() + '/public'));
|
||||||
} else {
|
} else {
|
||||||
server.use(serveStatic(path.join(__dirname, './public')));
|
server.use(serveStatic(__dirname + '/public'));
|
||||||
}
|
}
|
||||||
|
|
||||||
server.use(cors({ origin: true, credentials: true }))
|
server.use(cors({ origin: true, credentials: true }))
|
||||||
@ -66,4 +66,4 @@ module.exports = function(object, filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return server
|
return server
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 278 B |
@ -253,7 +253,7 @@ describe('Server', function() {
|
|||||||
it('should respond with html', function(done) {
|
it('should respond with html', function(done) {
|
||||||
request(server)
|
request(server)
|
||||||
.get('/')
|
.get('/')
|
||||||
.expect('Content-Type', /html/)
|
.expect(/You're successfully running JSON Server/)
|
||||||
.expect(200, done);
|
.expect(200, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user