I have tried installing type definitions with:
My code is in server.js
javascript file.
npm install @types/express
But still it doesn't seem to give intellisense for app after instantiating express .
But when I use express like this :
app = express() ;
app.listen(8000) ;
How to fix this ?
import this code:
/** @type {import("express").RequestHandler} */
Add this JsDoc comment to your controllers:
/** @type {import("express").RequestHandler} */
exports.myController = (req, res) => {
// biz logic. ( here you would get intelliscence on req, res objects )
const { id } = req.query;
const { data } = req.body;
res.status(200).json({data});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With