0
module.exports = function (app) {
    app.get('./todo', function (req, res) {});
    app.post('./todo', function (req, res) {});
    app.delete('./todo', function(req , res){});
};

I'm using WebStorm 2017.2.5 and Express package 4.16.3. My issue is get method works fine but post and delete got "unresolved function or method post" warning.

Any insight is much appreciated.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Lakshitha Wisumperuma
  • 1,574
  • 1
  • 10
  • 17
  • 2
    Possible duplicate of [node-express app.get() marked as unresolved in webstorm](https://stackoverflow.com/questions/26116124/node-express-app-get-marked-as-unresolved-in-webstorm) – Zeeshan Hassan Memon Apr 12 '18 at 18:47

2 Answers2

2

the problem is that the express methods list is generated dynamically, and it's not possible to resolve these properties using static code analysis. Running npm i @types/express should solve the problem:

enter image description here

Please read more here: https://www.jetbrains.com/help/webstorm/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

lena
  • 90,154
  • 11
  • 145
  • 150
2

You need to download and install the "express" library in WebStorm. Go to Preferences > Languages and Frameworks > Libraries > Download. Find the "express" library and hit Download and Install. This should work.