Moorad / youtube-video-downloader

199 stars 138 forks source link

"Cannot GET /" error when loading in localhost:4000 #5

Closed JoshSalway closed 5 years ago

JoshSalway commented 5 years ago

"Cannot GET /" error when loading in localhost:4000

invinciblemuffi commented 5 years ago

@JoshSalway : The above error comes as express cannot find the route /. What you need to do is write 3 simple lines of code in your index.js file. app.get('/', (req,res) => { res.render('index') });

  1. app.get is creating a GET request with the route /
  2. render method will render index.html page when the server i.e express/Node sees the URL /

"Cannot GET /" error when loading in localhost:4000

Moorad commented 5 years ago

I will be changing it so that it runs the index.html by default via the server