'Express + Typescript: How to GET Param and Body request
I route put method to this
const createFaceList = (req: Request<{faceListId : string}>, res: Response, next: NextFunction) => {
console.log(req.body.name);
console.log("faceListID = " + req.params.faceListId);
addFacelist(req.params.faceListId, req.body)
.then( result => {
return res.status(200).json({result})
})
.catch(err => {
logging.error(NAMESPACE, err.messagem, err);
return res.status(err.statusCode).json({
statusCode: err.statusCode,
message: err.message
})
})
}
my console.log show that undefined:
undefined
faceListId = undefined
how to fix. thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
