I'm trying to apply this middleware variable into my post request in my website, it is supposed to console log the id of the user but it returns undefined, could you please help me with this issue? If I'm applying the middleware incorrectly or something like that?
middleware
export const requireSignin = jwt({
secret: process.env.JWT_SECRET,
algorithms: ["HS256"],
});
Controller
export const createConnectAccount = async (req, res) => {
console.log('REQ USER FROM REQUIRE_SIGNIN MIDDLEARE', req.user)
console.log('YOU HIT CREATE CONNECT ACCOUNT ENDPOINT')
}
import express from 'express'
const router = express.Router()
//Controllers
import express from 'express'
import { requireSignin } from '../middlewares'
const router = express.Router()
//Controllers
import { createConnectAccount} from '../controllers/stripe'
router.post('/create-connect-account',requireSignin, createConnectAccount)
module.exports = router