Create login with NodeJS and MySQL

I am following this tutorial: https://codeshack.io/basic-login-system-nodejs-express-mysql/

There are NodeJS and Express functions used to setup a connection to the MySQL database, and respond to http GET & POST requests. My question is: where does the server get setup? What I understand currently is that I need the http.createServer() call somewhere to start the actual server. Would this go in the same code, or in a separate file?

Thank you for the help.

The server gets setup by using express

var app = express();

and then express tells it to listen on port 3000

app.listen(3000);

Look into the docs for express here https://www.npmjs.com/package/express

Dascolt,
Thank you so much. That makes sense. In the freecodecamp nodejs/express tutorials it looked like they setup the server separately, so I got confused. Very much appreciate your help and the documentation link.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.