In this part, we are going to create a survey that they send a request from the browser and decide
what response to send to the process.
So first we did all the unnecessary things.
So we did it, these files.
And that means that we create.
And instead, we create a new file called SSAFA, and this is the name you wanted, but we just want
to create a server.
Yes.
And for us, we required to call Mojo's code, so we create a constant HTP equal to require HTP and
then to create a server we can use HTP not.
Great surfer method, and we can also store these into a surfer, Constance.
And they say combat functions.
And this one shouldn't be a one every time a request come to the server and this function takes a week
object and also a response object that they perimeter's.
The weakest object contains things such as we do our own, but in this exampled, we ignore it and just
returns.
A crash is made.
The response object is to send a response to the user in the browser.
To actively listening for the request being sent to the surface, to actively listen for the request
being sent to the surface, we need to invoked a listening method.
So we have to read it or listen, and then we have to pass the arguments like port hostname and we have
and create these reasonable.
So we have to create a constant port is equal to 3000 and constant hostname is equal to localhost and
I we have a callback function and every console a lot listening on board.
And we use Temperley tomorrow to pass the lumber here so we can run the program by piping note server.
And we cannot find a module's you cannot find a motive, and because databased problems occurred that
I created foder here, so I have to move this file to the voter and runs the server again.
And you can see the process is ongoing.
And this is because the server is running in the background and listening for the request.
So to cancel this, we can press control, see?
To cancel the server and actually we can also delete this one, because for localhost we can skip this,
but for other cases you have to add the hostname so we can run the server again.
And if we go to the browser and type localhost free thousands and the browser use hand and waiting for
the server response, but we do not end, but we do not get any response yet.
So when you go back to the surf and you can see a message, a request is made is logged it to the console.