Im trying to get started with expressjs. I created a skeleton by running express expressSkApp.
Once the skeleton creation is done and I start the server, I'm supposed to get response upon hitting http://host:port (http://localhost:3000). But nothing happens at all when I do this. From network monitoring I have found out the request is getting cancelled. And there is nothing in server log. Any reason for the request getting rejected?
After debugging a bit I saw in app.js there is a line of code app.use('/', routes); that redirects the request to a specific route. After debugging, I found out that the request is not getting redirected at all. The moment I change it to app.use('/home', routes); and hit the url http://localhost:3000/home, response is received. Why is this behaviour? What if I want to hit http://localhost:3000/ and what it to be redirected to a concerned page? May be I'm missing out on something here.
My package.json dependency section looks like
"dependencies": {
"express": "~4.9.0",
"body-parser": "~1.8.1",
"cookie-parser": "~1.3.3",
"morgan": "~1.3.0",
"serve-favicon": "~2.1.3",
"debug": "~2.0.0",
"jade": "~1.6.0"
}
Aucun commentaire:
Enregistrer un commentaire