Codecademy Forums

Unable to start server for Boss Machine Project

I’m trying to get started on the boss machine project for creating back end web servers.

https://www.codecademy.com/paths/create-a-back-end-app-with-javascript/tracks/bapi-learn-express/modules/boss-machine-project/informationals/bapi-p4-boss-machine

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?

1 Like

Hi @m_richie

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.

Hey @m_richie

If the code on the left is the project starter “as-is”, then it’s behaving as intended.

From the readme.md file:

### 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. :slight_smile:

1 Like