Getting Authenticated User - Implementation
1 - Route Name
const express = require('express')
const router = express.Router()
const isAuthenticated = require('../middleware/auth.middleware')
const { registerUser, getAuthUser } = require('../controllers/auth')
router.post('/', registerUser)
router.post('/auth', getAuthUser) // This is our new route
module.exports = routerconst catchExceptions = require('../../utils/catchExceptions')
/**
* Gets the currently authenticated user in the current session.
*/
const getAuthUser = catchExceptions((req, res) => {
// our code goes here...
})
module.exports = getAuthUser2 - Input Request
3 - Middleware
4 - Validation
5 - Domain
6 - Events
7 - Response
Last updated