Url shortener microservice

Hello everyone!..noob question but i am confused…where are the body properties i’m supposed to handle?..am i supposed to pass them as parameters in the app.post path or do i have to make a database?

You need the ability for your app to accept POST request containing a url. The tests will make the requests. You just have to make sure you have the code to handle the requests. You can test you app by making POST requests using something like Postman or just use the form that is already present in the boilerplate code and submit them that way.

Thank you,now i get it

This is a concept which confused me at first too.
You’ll notice that when you work on FCC backend projects, much is already set up for you in the boilerplate.
I found it useful to familiarise myself thoroughly with it all first, so I could understand exactly how it all worked.

In your index.html file:

<form action="api/shorturl" method="POST">
    <legend>URL Shortener</legend>
    <label for="url_input">URL:</label>
    <input id="url_input" type="text" name="url" placeholder="https://www.freecodecamp.org/" />
    <input type="submit" value="POST URL" />

It should be fairly self-explanatory but the important bit is the opening form tag. When the form is submitted, the action attribute specifies where the form data will be sent. In this case, it will send the data as a POST request to api/shorturl. This data populates the req.body (request body) object and can be picked up as such on the backend in your routing code. The name attribute of your input tag will be a key in req.body and the key’s value will be the value entered into that input field by the user.

I hope that makes sense!

Yes, i’m a little bit familiar with handling requests coming from the front end to back end, but in this case my mind stuck and never came to it that data is coming from a form in the front end,i thought i had to get it from somewhere else(noone knows where)…It all makes sense now,thank you