Project not getting tested successfully

Tell us what’s happening:
I have tried solving this by my own and have successfully completed it in glitch but it is still not getting tested successfully by fcc.

**Your code so
here’s the link to my glitch project : https://metadata-microservice-fcc.glitch.me/

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0.

Challenge: File Metadata Microservice

Link to the challenge:

Hello!

You need two things:

  1. Implement cors. For that, just install the package with the same name and then copy paste the following code:
const app = express();
const cors = require("cors");

const allowedOrigins = [
  "https://www.freecodecamp.org",
  "https://freecodecamp.org"
];
app.use(
  cors({
    origin: (referer, cb) => {
      if (allowedOrigins.indexOf(referer) !== -1) {
        return cb(null, true);
      }
      console.debug('Referer:', referer);
      cb(new Error("You shall not pass!"));
    },
    status: 200
  })
);
  1. You need to implement an endpoint called /api/fileanalyse, which is the supposed to receive the files. This should be mentioned on the instructions, but it’s not, sorry about that :sweat_smile:. You can rename your current / endpoint with the /api/fileanalyse and it should work.
1 Like

oh my thanks a lot. Now that you mentioned it I do remember that fcc tests the api so it must correspond with cors to allow request from different sites. Again thanks a lot for replying and helping.

1 Like