typicode / json-server

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

Is there any way not to save record with POST, PUT, PATCH or DELETE requests? #645

Open tackeyy opened 7 years ago

tackeyy commented 7 years ago

json-server is cool and I like it. Is there any way not to save record with POST, PUT, PATCH or DELETE requests? Although I checked options in README, I didn't find the option that I want.

yanguoyu commented 7 years ago

you can use middlewares to Intercept which request you donot want to save. like this //拦截post请求返回 const interceptionPost = postApp.post('*',function(req,res,next){ //返回 res.end(); })

tackeyy commented 7 years ago

@yanguoyu Thank you. I'll try it :)