typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
73.15k stars 7.03k forks source link

Intercept request for with DB query? #616

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi,

I am about to mock authentication via basic auth and server side sessions with json-server, which works quiet well.

Intercepting requests as documented:

server.use((req, res, next) => {
  next()
})

Is it possible to query the DB in here somehow, so that I can check for user/pass in the DB before I continue?

Thanks!

ghost commented 7 years ago

Any idea?

oooowl commented 7 years ago

I need it too ,i think it is a good idea