[Solved] why I can’t install socket.io
You can use ‘yarn’; first, yarn install second, yarn third, yarn run dev 1 solved why I can’t install socket.io
You can use ‘yarn’; first, yarn install second, yarn third, yarn run dev 1 solved why I can’t install socket.io
You should take into account that nodejs often uses asyncronous calls, and this is the case with your code too. fs.readFile(‘index.html’, (err,html)=>{ if(err){ throw err; } console.log(html); // html works here }); console.log(html); // html is undefined here This should work fs.readFile(‘index.html’, (err,html)=>{ if(err){ throw err; } var server = http.createServer((req,res)=>{ res.statusCode = 200; res.setHeader(‘Content-type’,’text/plain’); … Read more
It all starts from function start() at the bottom. For displaying purpose i’ve used a small dataset but you can require the data from the json file by using const data = require(‘data.json’). I’ve tested for large dataset also, works like a charm. Hope it helps. const data = { “United States”:[ “Washington”,”Bratislava”,”Hard”,”Going”], “Afghanistan”: [ … Read more
The -g is short for global. It installs the module globally instead of in the current directory. See this for more info: https://docs.npmjs.com/cli/npm solved NPM command arguments