I have a basic app that posts an object to the back end.
Frontend is nextjs and backend is django, thus backend does not matter for this question
I am sticking to crud/rest as much as I can.
My question is what is the best way to show form for any given post.
lets say you are posting and “item” and it has “name” and “date”
so a simple json of {person:{name:mike,date:today}
.
Lets assume this is a valid json, omitted quotes and lets not think why I named an object Mike. Sorry Mike incase if you are reading this.
and my backend for item is at
GET blah.com/api/items for list
GET blah.com/api/items/id retrieve
UPDATE blah.com/api/items/id Update
POST blah.com/api/items create.
DELETE blah.com/api/items/id delete
But for frontend I do not see a pattern to be followed.
For example.
blah.com/items in nextjs lists items.
for posts what sort of route do you follow.
Something like this?
blah.com/items/create
for update blah.com/items/1/update
I do not want to keep a state on what to show in one route as in “Ah user clicked edit lets set showForm to True and hide lists of persons”
I think each major component should have its own route and if that is the case what is the convention ?
is this the way to go or do you keep a state for what to show so you handle get and post in one route?
thanks for input