Skip to content

Instantly share code, notes, and snippets.

@agustinfece
Created Jun 16, 2021
Embed
What would you like to do?
routes.js
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