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

Just some background, I got my front end certification before FCC made the shift to the new systems so I’m trying to do the API certification directly and skipping the front end and Javascript sections. So if this is answered in those sections that’s why I don’t know how to use the new system. That said, I’m trying to do the problem “Managing Packages with Npm - How to Use package.json, the Core of Any Node.js Project or npm Package” but when I try to use the url https://glitch.com/edit/#!/daffy-catshark to share my code using the link that Glitch provided and paste it into the solution line, I get this result:

// running test
Unexpected token < in JSON at position 0
// tests completed

This is after I placed the “author” line in the package.JSON file. Seeing that it didn’t work, I tried removing the “author” line and testing the original and it still ended up with the same error. I’ve never had to use Glitch before so I’m a bit lost and I can’t move forward without it.

5 Likes

Hi,

It looks like you’re using the url for the development(editor), use the app url. Click on the share button upper left corner and copy the link for sharing your App, paste in the solution.

10 Likes

That works perfectly, thank you!

Thanks, this answered my question too.

This should be explained somewhere on the challenge pages.

1 Like

Why the ? is this not in the ? instructions? It asked me for the URL!?!?!?!?!?!
Not a ?n share this app in a menu with a choice of buttons URL!!!

Aaaaaaaggghhhh! If lesson 1 is this vague, I don’t think I’ll bother with the rest.

1 Like

I concur. This threw me as well. Note that I jump around, and jumped into some express project stuff calling for the use of Glitch, so I was sorta presuming I just missed/skipped the section of curriculum that explains “how to use Glitch for coding and how to share progress and solutions to fcc exercises…”

But would be wise to provide a jump to docs that explain this wherever relevant.

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