What return method is appropriate for controller actions for SPA frontend?
I have a basic CRUD app with a React SPA and a Postgres database. I want to know what I should return in the controller actions, specifically for Get, Post, Put and Delete actions. I've inspected some docs like this: https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/details?view=aspnetcore-8.0
which use
Any help would be appreciated.
For instance would it make sense to use the
Additionally, what should I do regarding the delete action? I don't want to return anything but it seems I have to return something.
which use
RedirectToAction. However this doesn't seem like it makes sense to use for a React SPA. I've been unable to find any relevant information on this topic of appropriate return methods for SPA. Any help would be appreciated.
For instance would it make sense to use the
CreatedAtAction for my Post controller action? Or could I simply just return createdNoteDTO? I want to send the created object back to the frontend.Additionally, what should I do regarding the delete action? I don't want to return anything but it seems I have to return something.