import express from 'express';

import * as userController from '../../controllers/users';
import * as recipeController from '../../controllers/recipes';
import * as favoriteController from '../../controllers/favorites';

import * as auth from '../../middleware/auth';

const user = express.Router();

user.post('/signup', userController.signUp);
user.post('/signin', userController.signIn);

user.get('/myRecipes', auth.default);
user.get('/myRecipes', recipeController.getUserRecipes);

user.post('/:userId/recipes/:recipeId', favoriteController.addToFavorite);
user.delete('/:userId/recipes/:recipeId',
  favoriteController.removeFromFavorites);
user.get('/:userId/recipes', favoriteController.getFavRecipes);


export default user;

import express from 'express';

import * as userController from '../../controllers/users';
import * as recipeController from '../../controllers/recipes';
import * as favoriteController from '../../controllers/favorites';

import * as auth from '../../middleware/auth';

const user = express.Router();

user.post('/signup', userController.signUp);
user.post('/signin', userController.signIn);

user.use('*', auth.default);
user.get('/myRecipes', recipeController.getUserRecipes);

user.post('/:userId/recipes/:recipeId', favoriteController.addToFavorite);
user.delete('/:userId/recipes/:recipeId',
  favoriteController.removeFromFavorites);
user.get('/:userId/recipes', favoriteController.getFavRecipes);


export default user;

Add auth middleware after signup/signin user routes
Add auth middleware after signup/signin user routes
