-
-
Save agustinfece/8059754189c582a0d991149f3a2ed27c to your computer and use it in GitHub Desktop.
routes.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import { signup, login, isAuth } from '../controllers/auth.js'; | |
const router = express.Router(); | |
router.post('/login', login); | |
router.post('/signup', signup); | |
router.get('/private', isAuth); | |
router.get('/public', (req, res, next) => { | |
res.status(200).json({ message: "here is your public resource" }); | |
}); | |
// will match any other path | |
router.use('/', (req, res, next) => { | |
res.status(404).json({error : "page not found"}); | |
}); | |
export default router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment