New Sails JS answer in WebStorm

I'm new to Sails JS .. I'm trying to create a new custom answer, I didn't find any autogenerator, so I created it manually.

module.exports = function someName(data, options) {


I'm trying to access this answer from a controller:

module.exports = {
    someController: function(req, res) {


The problem is that WebStorm doesn't recognize this response.

Unresolved function or method someName.

But when the app is running - it works .. (WebStorm recognizes the default responses that come with "new someApp sails").

Thank you for your help!


source to share

1 answer

The code in the Sails.js library that loads custom responses probably does something like this:

files = getFilesInApiResponsesDirectory()
files.forEach(function(file) {
  name = extractName(file);
  res[name] = require(file); // <-- too dynamic to infer at this point


It is not possible for the WebStorm code analyzer to be able to make a connection between res

and your custom response function without actually running the Sails.js code or getting a hint (less dynamic, more explicit).

In any case, the message you receive does not necessarily represent a fatal error, it is a "code check", you can disable or suppress .



All Articles