Install and Require Helmet


The task is to clone the github repo. I did that. Here is the link: GitHub - xraise17/boilerplate-infosec: A boilerplate for the freeCodeCamp curriculum.

I get the following error.

Meanwhile the package.json does include the helmet 3.21.3.

What do you think is wrong?

Hi there and welcome to our community!

From the instructions:

Helmet version 3.21.3 has already been installed, so require it as helmet in myApp.js .

You have the following code in myApp.js:

const express = require('express');
const app = express();

Just as express has been required, do the same with helmet, below these two lines of code.

Hello there and thanks for taking the time to respond. I have updated the repository (myApp.js) with
const express = require(‘express’);
const app = express();

const helmet = require(‘helmet’)
const app2 = helmet();

and it doesn’t seem to work. First, I tried this
const express = require(‘express’);
const app = express();

const helmet = require(‘helmet’)

but none of them seem to work.

What are you submitting?

You have to run the server locally and submit the localhost address http://localhost:3000

Also, don’t run helmet. It is middleware, and you will use it in the coming challenges. For now, just require it.

1 Like

I was just updating the repository on Github and providing the link to it. Didn’t know that I would have to run a server locally. Any guidance on that?

  1. Install Node.js

  2. Install the dependencies from the terminal npm i

  3. Start the server npm start from the terminal.

Or use Gitpod instead. You will learn more about the server side in the next section on Node/Express.

The thing is that gitpod isn’t working, I have been tried the past 3 days. What is the process called exactly to search it on the web/youtube etc.?

What isn’t working with Gitpod?

You can use Replit or Glitch as well.

Go to the node website and download it. Install it. Open your terminal inside the code folder, you can also use the built-in terminal in VS Code. Then run the two commands I gave you.

For the Gitpod, I get the error “Error timeout, the server isn’t connecting”. Same goes for Replit. I tried using both “microsoft edge” and “chrome”. I will be continuing with installing node.js locally and see what happens. The thing is that some other courses require to work on gitpod :confused:

Sounds like a network issue on your side. You might try using a public DNS, and maybe a VPN to check if it is related to your DNS/IP.

I realised that the network that I was on was preventing me from accessing gitpod. Now that I connected from another network I am allowed to enter gitpod. I have made the changes discussed above and when providing the freecodecamp with either “” or “http://localhost:3000” I get the error

Runned it locally, this is the solution, many thanks!