Questions tagged [web-api]
Specific APIs that communicate over web protocols, such as ASP.net Web API, as well as APIs that are exposed to web pages for network communication or apps for device communication
391 questions
-1
votes
2
answers
170
views
ASP Net Web API Clean Arch and project references
I have an asp net web api project using clean arch. These are the layers:
API (controllers)
Application (UseCases)
Domain
Infrastructure (database access
I need perform an http call and according to ...
1
vote
1
answer
388
views
Which approach to specifying a database connection in a web API, is preferred?
Where I work, they have never implemented web APIs. At my previous job, which I left 11 years ago, I would write several web APIs to be used for applications, reports, etc. So when I came to this job ...
23
votes
4
answers
9k
views
Purpose of async/await in web servers
I don't understand why I keep seeing async/await recommended (or sometimes, even enforced) for ASP.NET Core web applications and APIs.
As far as I can tell, every request is already being run on a ...
2
votes
3
answers
3k
views
How to design for API use cases that need different data from the same table?
I am building a web application. This application is meant to be a home for player rankings and tournament results for a competitive community. I have planned to do this in three layers: a database to ...
96
votes
15
answers
19k
views
Should we design our code from the beginning to enable unit testing?
There's a debate going on in our team at the moment as to whether modifying code design to allow unit testing is a code smell, or to what extent it can be done without being a code smell. This has ...
2
votes
3
answers
503
views
DDD and Domain Models with a Web Api PUT / POST
The company I'm working at has strict policies that insist that all business logic is contained in Domain Models as part of DDD.
I can see how this approach could work well for something like a ...
4
votes
4
answers
1k
views
Is it okay to deploy both front end and backend everytime if they are in a single repository
I have a project with .net core web api backend and angular as front end.
I have single repository for both the projects with front end and backend in their own separate folders.
I have written ...
0
votes
1
answer
737
views
Should you use nested routes within NestJS for a "RESTfull" API
Here is an Example API for managing companies, employees, and their children. My entity relationships are as follows:
company -1:n-> employees -1:n-> children
I’ve structured the API routes ...
1
vote
1
answer
296
views
ASP.NET MVC and Web API Together vs. ASP.NET MVC with JSON-Returning Action Methods
In an ASP.NET MVC application with views that make AJAX calls for widgets like dropdowns and data grids, is it better to use Web API controllers or regular MVC action methods that return JSON?
The ...
2
votes
5
answers
409
views
Purpose of async/await in web servers when stuck with legacy I/O
A couple days ago I asked about the Purpose of async/await in web servers, and got in-depth answers explaining how in fully asynchronous code, it frees up the CPU completely while also releasing the ...
75
votes
4
answers
31k
views
Why PATCH method is not idempotent?
I was wondering about this.
Suppose I have a user resource with id and name fields.
If I want to update a field I could just do a PATCH request to the resource like this
PATCH /users/42
{"name&...
35
votes
5
answers
35k
views
Should I check if something exists in the db and fail fast or wait for db exception
Having two classes:
public class Parent
{
public int Id { get; set; }
public int ChildId { get; set; }
}
public class Child { ... }
When assigning ChildId to Parent should I check first if ...
0
votes
1
answer
148
views
OpenAPI - `v0.x.x` as a way to denote unstability
In OpenAPI, is there a convention for denoting that your API is not stable yet?
In semantic versioning, the v0.x.x version number is usually used to indicate that the project is not stable yet. ...
1
vote
1
answer
273
views
Is there any way to have an android or iOS app expose a web-api?
I want to develop a miminal app for iOS and Android.
Basically, I want to have a widget (or similar micro-app) that displays how many items I have in a list. If I open the widget, it just opens a ...
60
votes
3
answers
52k
views
Is performance the only reason not to use SignalR (websockets) entirely in lieu of a traditional REST API?
I have used SignalR to achieve real-time messaging functionality in several of my projects. It seems to work reliably and is very easy to learn to use.
The temptation, at least for me, is to abandon ...