Cannot GET with Connect on Node js

0 votes

I am using connect to serve some static webpages like this:

var connect = require("connect");
var nowjs = require("now");
var io = require("socket.io");


var app = connect.createServer(
  connect.static(__dirname + '/public')
);

app.listen(8180);

I am getting this response: " Cannot GET / " after I added a simple index.html at the /public directory on the same directory as the app.js file. I got the response when I tried to view the page on my browser.

Can someone explain to me why this response is coming? And how can I solve this?

May 12, 2022 in Node-js by Kichu
• 19,040 points
946 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Node-js

0 votes
1 answer

How to get GET (query string) variables in Express.js on Node.js?

Hello @kartik, Since you've mentioned Express.js in your ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,840 points
3,267 views
0 votes
1 answer

How do I get the path to the current script with Node.js?

Hello @kartik, you can do this: fs.readFile(path.resolve(__dirname, 'settings.json'), 'UTF-8', ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,840 points
2,863 views
0 votes
1 answer

How to get Node.JS Express to listen only on localhost?

Hello @kartik, This is a bug in hive-go that only ...READ MORE

answered Oct 16, 2020 in Node-js by Niroj
• 82,840 points
7,402 views
0 votes
0 answers

How to get started with Node.js?

How to get started with Node.js? "I’m trying ...READ MORE

Nov 26 in Node-js by Nidhi
• 3,820 points
30 views
0 votes
1 answer

Node.js version on the command line?

Hello @kartik, The command line for that is: node ...READ MORE

answered Jul 13, 2020 in Node-js by Niroj
• 82,840 points
665 views
0 votes
1 answer

How do I determine the current operating system with Node.js

Hello @kartik, With Node.js v6 (and above) there ...READ MORE

answered Jul 14, 2020 in Node-js by Niroj
• 82,840 points
3,849 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,940 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,465 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP