Skip to content

Instantly share code, notes, and snippets.

Created June 16, 2021 14:46
What would you like to do?
import express from 'express';
import { signup, login, isAuth } from '../controllers/auth.js';
const router = express.Router();'/login', login);'/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