System Information
- Strapi Version: 4.0
- Operating System: macOS Catalina 10.15.7
- Database: SQLite (default)
- Node Version: v14.17.4
- NPM Version: 6.14.14
Hi. I recently updated to v4 (new to Strapi, only worked a little with v3). I’m trying to create a content-type entry via a request sent from a frontend. From the documentation I understand that a controller must exist in the /api/my-content-type/controllers/my-content-type.js
but there is not enough info for me to get the request working. (Controllers | Strapi Documentation)
I’m trying this step by step to understand, here are images of my code.
(Due to the limit on images I can include in the initial question, I’ll post the other images below.)
This is how the controller currently looks like (I’m logging ctx.request.body
to see if the data gets through, which it doesn’t)…
…img #2 shows the request that is send from the frontend.
…img #3 shows the error I’m getting in the response ("Unexpected token o in JSON at position 1"
)
How does the controller need to be set up and the request to be formatted in order to create/update entries? Any help of guidance in the right direction would be great. I’ve looked through the docs and can’t find details on these questions.
Thanks.