DEV Community

Discussion on: Setup a Node Express API with TypeScript (2021)

Collapse
 
theprogrammer21 profile image
Lukas Windisch

Unfortunately my environment doesn't recognize the express.json() function.

Property 'json' does not exist on type 'Express'.

This happens when I execute the exact same code.

Collapse
 
airor4 profile image
Airor4

I made an account just to try and answer your question. Certain versions of Express have bodyParser bundled in with it. If .json() is not working for you you can npm i bodyParser and use that instead. See: stackoverflow.com/questions/472321...

Collapse
 
theprogrammer21 profile image
Lukas Windisch

Thank you a lot for doing that!
In fact I just had an old version of the @types/express package where the json() function has not existed yet.