node.js - Unresolved function or method for pipe() -
i'm trying write simple file web file server. i'm using phpstorm.
var http = require('http'); var fs = require('fs'); function send404request(response) { response.writehead("404", {"content-type": "text/html"}); response.write("404 page not found"); response.end(); } function onrequest(request, response) { if (request.method === 'get' && request.url === '/') { response.writehead("200", {"content-type": "text/plain"}); fs.createreadstream("./index.html").pipe(response); } else { send404request(response); } } http.createserver(onrequest).listen(8888); console.log("file server running...");
however, phpstorm says "unresolved function or method pipe()"
here setting javascript libraries in phpstorm:
any idea goes wrong?
in settings/project settings/javascript/libraries, download "node-definitelytyped". work me. had same issue your.
Comments
Post a Comment