Problem with taking Glitch url and using it as a solution for question

I’m here for the same reason. While I think googling-for-answers is a highly useful skill, sometimes it’d be great if stuff was just obvious.

1 Like

Hi girls/guys

I’d like to share with you my 2cents after struggling with this issue and passed it successfully.

You can pass this test without using Glitch services at all. You only need to be sure that you are using res.json() properly and you are not rendering HTML or invalid JSON characters.

Here’s my solution:

let jsonTpl= `{
        "author": "John Doe",
        "description": "freeCodeCamp - Apis And Microservices Certification (300 hours)"
}`;
app.get('/_api/package.json',function(req,res){
        res.json(jsonTpl);
        res.end();
});

Hope it helps you!
PS: Why should we use Glitch? it’s an unnecessary pain.

Regards

1 Like

Hello, thank you. I updated package.json and did the same but got a “Not Found” error. Could you please help?

Thank you

Go to the github and copy the code in server.js to the one in glitch

Thank you. I tried that but get a timeout error now

Can you share the link to access your glitch ?

https://freecodecamp-boilerplate-infosec-11.glitch.me

I also tried remixing the project and got till this:
https://innate-art.glitch.me/package.json

Which exercise are you doing ?

Hi, if your starting the Introduction to the Managing Packages with npm Challenges - use the following link

It doesn’t look like you directory is intact. Your missing the server.js as well as several other files from the looks of it.

Hi, my apologies - I just read entire thread and think I’m caught up. If you’re working in the Info Sec challenges and are currently trying to pass the Content Security Policy, which can be tricky. Providing your code is right, try clearing your browser cache and cookies.
https://helmetjs.github.io/docs/csp/

Introduction to Information Security with HelmetJS Challenges

I was able to complete the challenge after signing into glitch with github and using the glitch link provided here
Thank you

Hello,

Any of the above solutions worked for me. Instead of using the “Share” button which provides you with an URL of this kind: https://glitch.com/~solid-stop (solid-stop is the name of my project) I’d rather suggest to use the following.

Here is the fix : https://solid-stop.glitch.me (replace “solid-state” with the name of your project)

2 Likes

Thanks @NOLT, this worked for me

In my case the problem was more complicated.

Somehow Glitch was deleting files imported from Github.

So server.js was just empty.

I had to manually copy the content from server.js file on Github and paste it on Glitch.
The veiws/index.html was also needed.

The URL worked as described above.

https://{{project_name_on_glitch}}.glitch.me/

I ended up using repl.it instead of Glitch.

  1. Import files from Github https://github.com/freeCodeCamp/boilerplate-npm/ to Repl: https://repl.it/github
  2. Copy server.js content to index.js

This issue is still ongoing. I tried everything above and nothing worked. The issue is Glitch is not importing the files from Git, whether you use the link or if you go to git and copy the .git link.

The only thing that worked for me was to manually copy and paste all the files over from git to glitch.

2 Likes

I had the same problem. First I was getting the “JSON” error cause I was copying the wrong URL. Then I started getting the “Timeout” error. As @dkimble said above, the only thing that worked was manually copy and paste everything from git to the glitch project.

thanx, solved my query too.