Projetos API .preciso de ajuda

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

Não vai pra lugar nenhum. Tenho q abrir o reposiro? Replic?

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 11; SM-M127F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.85 Mobile Safari/537.36

Challenge: Timestamp Microservice

Link to the challenge:
https://www.freecodecamp.org/learn/back-end-development-and-apis/back-end-development-and-apis-projects/timestamp-microservice


I don’t think you need a repo for this, depending on where you are doing this.

Do you have any problems with your code? If so, please provide a link to the code and explain the problem you are having.

Oi Kevin na verdade é porque não nem por onde começa… e no replic? Obrigado por responder…

I’m sorry, I’m not understanding. Maybe the meaning is getting lost in the translation.

Não sei o que fazer. Estou perdido, como cego em tiroteios… hahaha

This is difficult stuff. And making the transition to the backend projects is confusing - I remember.

These are the instructions:

Crie um aplicativo full stack em JavaScript que seja funcionalmente semelhante a este: https://timestamp-microservice.freecodecamp.rocks/. Trabalhar nesse projeto vai fazer com que você escreva seu código usando um dos seguintes métodos:

Quando terminar, certifique-se de que uma demonstração funcional do seu projeto está hospedada em algum lugar público. Em seguida, envie o URL para ela no campo Solution Link . Como opção, envie também um link para o código-fonte do projeto no campo GitHub Link .

Where do you get confused? How far have you gotten in that list.



Só abre essas páginas em branco…tenho q abrir em outro local?

OK, do you have a link to your API endpoint? Or your code? Pictures of results are not that helpful.


Clico aí e abre página em branco.

https://boilerplate-project-timestamp-1.beatrizgames.repl.co

1 Like

https://boilerplate-project-timestamp-1.beatrizgames.repl.co/


Onde estou errando?

app.get("/api/timestamp/:date_string", (req, res) => {
let dateString = req.params.date_string;
if (/\d{5,}/.test(dateString)) {
let dateInt = parseInt(dateString);

res.json({ unix: dateString, utc: new Date(dateInt).toUTCString() });

} else {
let dateObject = new Date(dateString);

if (dateObject.toString() === "Invalid Date") {
  res.json({ error: "Invalid Date" });
} else {
  res.json({ unix: dateObject.valueOf(), utc: dateObject.toUTCString() });
}

}
});

I can’t get the server to wake up, I will try again later.

Nope, I can’t get it open, it’s stuck on the “waking up” screen. Let me know if you get that resolved.

Não consigo também resolver… onde devo colocar o código em servidor JS?

Replit will create the server for you. But the link that you provided is not loading. I would need to see a functioning repl to help.

Será q eevi colocar my secret do mongoose?

https://boilerplate-mongomongoose-30.beatrizgames.repl.co
Tenho do exercício anterior…

OK, I was finally able to get to your replit account here:

I don’t know what, but there is something weird about the links you are providing. I guess that last one kind of worked, but it just didn’t have the typical HTML content.

OK, so stop creating new forks. Just pick one and work with that. It should be a fork of this repo.

See what you can do with that. See if you can set up a “ping” endpoint - a GET to /ping that just returns "pong", to confirm that it’s working.

If you run into trouble, ask a question, but be very specific. Vague questions don’t get good answers.

seu projeto esta identico ao exemplo da liçao . onde devo alterar ? o que alterar dentro do Replit?

<html>
   <head>
      <title>Timestamp Microservice | freeCodeCamp.org</title>
      <link rel="shortcut icon" href="https://cdn.freecodecamp.org/universal/favicons/favicon-32x32.png" type="image/x-icon"/>
      <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
      <link href="style.css" rel="stylesheet" type="text/css">
   </head>

   <body>
    <h1>Timestamp Microservice</h1>
    <hr />
    <div class="container">
      <h3>Example Usage:</h3>
      <ul>
        <li><a href="api/2015-12-25">[project url]/api/2015-12-25</a></li>
        <li><a href="api/1451001600000">[project url]/api/1451001600000</a></li>
      </ul>

      <h3>Example Output:</h3>
      <p>
        <code>{"unix":1451001600000, "utc":"Fri, 25 Dec 2015 00:00:00 GMT"}</code>
      </p>
    </div>
    <div class="footer">
      <p>
        By <a href="https://www.freecodecamp.org/">freeCodeCamp.org</a>
      </p>
    </div>
  </body>
</html>