Comments (1)
Hi @igorgiovannini , thanks for the question!
If I understand correctly, you want to know why we do not take advantage of annotations like [HttpPut]
, [HttpGet]
, and [HttpDelete]
to handle different actions for the same endpoint. And also why we do not use [FromBody]
to get the payload automatically parsed.
We do not use annotations to define the path a controller method supports because we use our dotnet/services.json
file to define the routes. This is because before reaching our app, the requests will reach the VTEX IO Router, so both of them need to understand the same route definitions (otherwise we would need to synchronize the routes definitions, which is error-prone).
The service.json
route definition associates a controller method to a path. Having multiple controller methods for the same path would be possible only if we had the HTTP action to combine with the path in the route definition.
That said, we can use these annotations. The problem is that we need to use different endpoints for each action (one for a PUT, one for a GET, and another one for a DELETE, for instance). Having one controller method per action, you can also use [FromBody]
, [FromQuery]
, and cache annotations as you would do in any .Net app.
In this particular example, we want to be RESTful and have one endpoint to handle multiple HTTP actions, so we need to have only one controller method and check the actions and bodies when receiving the requests.
Long story short, we do not support RESTful APIs more easily because our route definitions do not have the HTTP actions.
from reviews-and-ratings.
Related Issues (20)
- Private queries HOT 1
- v2.12.5 Issues
- Can we have default stars to 5 when user begins to write review
- Display custom message with discount coupon after submission of review HOT 1
- Comportamiento de ordenamiento por fecha
- Misspelling on pt.json
- Looping request HOT 1
- No CSS Handler for show more Button element
- Remove unused dummy route HOT 1
- Navigation menu entry duplicated
- Create class for styling
- Translation bug HOT 2
- It is possible to add this component as a filter?
- Inaccuracy in cpu request HOT 3
- I need to change the the wording in the app. HOT 1
- Anonymous review is not working
- Modularizar o app
- CPU over usage
- Splunk over usage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reviews-and-ratings.