Probleme in code verifecation from freeCodeCamp platforl

Tell us what’s happening:
Hi, I think that I’ve realese all what is demanded in the chalnge but whenI submit it inform me that no one from the parts of the chanlenge was correct.
here’s my code.

var express = require('express');
var ip = require('ip');
var app = express();
var {detect} = require('detect-browser');
var browser = detect();
var window = require('window');

// enable CORS (
// so that your API is remotely testable by FCC 
var cors = require('cors');
app.use(cors({optionsSuccessStatus: 200}));  // some legacy browsers choke on 204


app.get("/", function (req, res) {
  res.sendFile(__dirname + '/views/index.html');

// your first API endpoint... 
app.get("/api/hello", function (req, res) {
  res.json({greeting: 'hello API'});

app.get("/api/whoami", (req,res)=>{
  const ipadr = ip.address();
  const Blanguage = req.headers["accept-language"].substring(0,14);
  return res.json({ipaddress: ipadr, language: Blanguage, software: req.headers['user-agent']});

// listen for requests :)
var listener = app.listen(process.env.PORT, function () {
  console.log('Your app is listening on port ' + listener.address().port);

can some one help please.

Your project link(s)

solution: http://localhost:49929/api/whoami

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36.

Challenge: Request Header Parser Microservice

Link to the challenge:

Hello There!
Looks like you’re submiting a link from your localhost:

solution: http://localhost:49929/api/whoami

I think that, in order to pass the test, the app should be hosted in somewhere public (like glitch, for example).

Welcome there,

I think this option is deprecated for cors.

I removed it, and the tests passed with the rest of your code.

Hope this helps

Hi, thank you for you’re response.
I already used starter project, and still have the same result.

Hi, thank you very much for your annswer.
I removed it and still have that same probleme.

Have you tried looking in the browser console to see any errors?

It work now I changed the work space from localhost to starter project and it work. @gnragazzi was rigth, I was wrong because I try that process for the first chalange and it didn’t success.
thank you very much @Sky020 and @gnragazzi for your help.
thank you very much good people.

Great! Glad to help :muscle: :muscle:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.