Install and Require Helmet

Task: https://www.freecodecamp.org/learn/information-security/information-security-with-helmetjs/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:
image

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 “https://freecodecam-boilerplate-gt4mk4mgyr0.ws-eu110.gitpod.io/” or “http://localhost:3000” I get the error
image
image

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

Hey i have no idea what to do after making it run, I’ve struggled with this task for 3 days and I’m just lost at the moment

How did you make it run?

I get the first step but i have no idea how to go about get the link after I get to github where there is the rest of the stuff is at

You submit the server link.

If you are running it locally, that would be http://localhost:3000 if you are running it on Gitpod, it is the link from the preview window (it starts with 3000:)

Do you have it running or not?

I would suggest you use Gitpod if you do not know how to run it locally.


  1. Install Node.js and git
  2. Clone the repo down to your PC.
  3. Install the dependencies from the terminal npm i
  4. require in helmet in myApp.js.
  5. Start the server npm start from the terminal.
  6. Submit http://localhost:3000

In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Ask for Help button located on each challenge. This will automatically import your code in a readable format and pull in the challenge url while still allowing you to ask any question about the challenge or your code.

Thank you.