node.js - MEAN Stack - Using jwt with express-restify-mongoose on only some REST methods -


I'm really new to all of these things, so please support me.

I try to make a relaxing API with MEAN stack - I have tried to use it to make things easier:

When If I run, then it is working perfectly for me:

restify.serve (app, hotel);

-> The app is obvious, and the hotel is my Mongoose. The model that tells my hotel schema.

This is also working with my 'token logic', and I can protect something like some restify'd URL:

app.use How can I protect some comfort methods with expressJwt ({secret: Mykeyken logic?}: Unless ({path: ['/ auth', '/']})

My problem is - like 'Post, Put, Daylight', like '/ API / Hotel' -> I like GAT to be public, but do not post, put and delete.

Is it possible? Your help greatly appreciated

The answer is:

Create a middleware like this:

(Return: (secret: 'secretstring'}) returning Jwt (return) (Req, res, next);};

and then:

  restify.serve (app, hotel, {middleware: olangent}};  

Comments