Skip to content

Commit 40a9627

Browse files
committed
Merge branch 'master' of https://github.com/typicode/json-server
2 parents 8d19f07 + 961f9e7 commit 40a9627

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
* Disable logging for static content requests
56
* Remove bad `console.log`
67
* Update dependencies
78
* Use [`nanoid`](https://github.com/ai/nanoid)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Start JSON Server
8989
$ json-server --watch db.json
9090
```
9191

92-
Now if you go to [http://localhost:3000/posts/1](), you'll get
92+
Now if you go to [http://localhost:3000/posts/1](http://localhost:3000/posts/1), you'll get
9393

9494
```json
9595
{ "id": 1, "title": "json-server", "author": "typicode" }

src/server/defaults.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,6 @@ module.exports = function(opts) {
2222
arr.push(compression())
2323
}
2424

25-
// Logger
26-
if (opts.logger) {
27-
arr.push(
28-
logger('dev', {
29-
skip: req =>
30-
process.env.NODE_ENV === 'test' || req.path === '/favicon.ico'
31-
})
32-
)
33-
}
34-
3525
// Enable CORS for all the requests, including static files
3626
if (!opts.noCors) {
3727
arr.push(cors({ origin: true, credentials: true }))
@@ -45,6 +35,16 @@ module.exports = function(opts) {
4535
// Serve static files
4636
arr.push(express.static(opts.static))
4737

38+
// Logger
39+
if (opts.logger) {
40+
arr.push(
41+
logger('dev', {
42+
skip: req =>
43+
process.env.NODE_ENV === 'test' || req.path === '/favicon.ico'
44+
})
45+
)
46+
}
47+
4848
// No cache for IE
4949
// https://support.microsoft.com/en-us/kb/234067
5050
arr.push((req, res, next) => {

0 commit comments

Comments
 (0)