Aye-Bee-See / sqlite-express-api

0 stars 0 forks source link

Protect the necessary routes #11

Open paxblueribbon opened 2 months ago

paxblueribbon commented 2 months ago

Don't protect the create-admin route until a default admin is being created on db start

paxblueribbon commented 3 weeks ago

Check out the protected route from the user routes for the example of how to do this through middleware:

router.get('/protected', passport.authenticate('jwt', { session: false }), function(req, res) { res.status(200).json({ msg: 'Congrats! You are seeing this because you are authorized.'}); });