Help with Issue Tracker project (misunderstanding?)

Hello there.

I think I am not understanding the description of one of the requirements.

Says this:

If you send a POST request to /api/issues/{projectname} without the required fields, returned will be the error { error: 'required field(s) missing' }

This does not make sense to me because in the form, we I try to leave the requirement field empty, this comes up:

The form is forcing me to write something as it is required. The situation where I submit a issue without the mandatory requirements does not happen. Same happens with the FCC original website: I leave a mandatory field empty and won´t allow me to submit anything.

So, what I am supposed to do? And what kind of error is expecting me to return? A text with a object? A json object?

I really don´t understand this part… :sweat_smile:

Your browser information:

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

Challenge: Issue Tracker

Link to the challenge:

The test doesn’t use the form, it just sends a POST request to the endpoint.

You are correct in saying that if the only way to POST data is through the form and the fields are required then the client validation would stop the submit from happening. However, relying only on client validation is not a very reliable approach and having some server-side validation and missing data contingency logic is always a good idea.

You likely also want the API and endpoints to work “frontend-less” and not rely on any frontend code. So you can communicate directly with the API and endpoints. In which case you have to do some logic on the backend to deal with missing or invalid data being sent.

Is this something that is part of the FCC curriculum that I missed? In the QA section I saw Mocha, Chai, Pug (I understood this is a template for HTML) and Socket.io (a library for real time communication like chats or those things).

I’ve realized that maybe I could use the Chai asserts to test this but…

How would I try to comunicate with the API frontendless?? If I want to see the error of empty field, I must be able to do this, right?

You’d likely want to use a tool such as Postman, or something like curl if you’ve got access to a terminal. Tools like this allow you to make HTTP requests to the API directly.

1 Like

I see. Thanks, I’ll do some research and have a look.

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