Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When require('json-server') in parent app, Express middleware doesn't get executed #42

Closed
julienbechade opened this issue Jan 7, 2015 · 4 comments

Comments

@julienbechade
Copy link

Hi,

I assume I'm doing something wrong here…
Here is my app.js:

var server = require('json-server')
var app = server({ schemas: [] }, 'db.json')

app.use(function (req, res, next) {
    console.log('Time:', Date.now());
    next();
})

app.listen(process.env.PORT || 3000)

This doesn't print anything to the terminal…

Thanks for your time.

@typicode
Copy link
Owner

typicode commented Jan 7, 2015

Hi Julien,

Even if you make a request?
The API could get some enhancement, it's not very clear how server() work.

@julienbechade
Copy link
Author

Even when I make a request.

@typicode
Copy link
Owner

typicode commented Jan 7, 2015

Forget about the "even if you make a request", I misunderstood your issue.
I'll have a look into this.

@julienbechade
Copy link
Author

Just read this issue and figured out how to mount json-server

Sorry for bothering you.

Thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants