I’m trying to get started on the boss machine project for creating back end web servers.
when I download the project and “npm install” followed by “npm run start” It start but never starts listening. If I download the solution code and repeat the same steps it begins listening. What am I missing here?
I suspect it’s because there’s something different between the code for the solution and your code. I’m guessing that your code is in the left-hand terminal in your screenshot. The terminal is giving you the message
clean exit - waiting for changes before restart.
If you can post the code you’re running, we might be able to help find the problem. Please remember to format your code with the </> icon, so it looks like this:
my code goes here
otherwise the formatting is lost!
Hey there, Both examples are unedited original project folders. The Terminal on the left is the project folder they give you to get started the Terminal on the right is the solution folder. If you have a look at the linked project and follow the setup instructions after downloading the project it will not begin listening.
If the code on the left is the project starter “as-is”, then it’s behaving as intended.
### Server Boilerplate
In **server.js**, you will see some boilerplate code, but the server is missing key functionality to allow it to run. You must:
- Set up body-parsing middleware with the `body-parser` packagae.
- Set up CORS middleware with the `cors` package. You can use the default settings.
- Mount the existing `apiRouter` at `/api`. This router will serve as the starting point for all your API routes.
>>> - Start the server listening on the provided `PORT`. Make sure to use the `PORT` constant and not a hard-coded number, as this is required for tests to run. <<<
Take note of the comments in **server.js**, as your code needs to fit into specific places around the existing boilerplate.
You’re required to add the relevant code to make the app listen on the desired port. It won’t do it by default, whereas the solution will have the necessary code to accomplish that.
Does anyone know how to find the solution code for the boss machine project? I would like to compare my code to the solution so I know I’m completing the project correctly.
I did that and it worked for me. Thanks! What a sense of satisfaction!