Skip to content

gn-sky/CityInfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample ASP.NET Core 8 Web API

Routing middleware is added to the request pipeline & attribute routing is used.

API gets & manipulates data from API endpoints, using the built-in dependency injection system. Endpoints are decorated with appropriate Http attributes: Get, Post, Patch, etc…

Endpoints return async Tasks to free up threads to be used for other tasks, improving the application's scalability.

ICityInfoRepository.cs: Repository Pattern is implemented.

Automapper is used to map between Entites & DTOs (Profiles folder).

Check GetCitiesAsync(string? name, string? searchQuery, int pageNumber, int pageSize) for searching & paging.

IQueryable is used for deferred execution: query is constructed with passed filters & executed in the end when iterated over with ToListAsync().

Connects to SQL database via Entity Framework Core 8 with code-first approach.

API is documented with Swagger.XML comments are used to make it more descriptive: Response Types & Status Codes. (Check GetCity endpoint in CitiesController.cs for a sample.)

CityInfoApiBearerAuth security definition (type: “Http”, scheme: “Bearer”) is required (check builder.Services.AddSwaggerGen in Program.cs). Sample jwt is generated in AuthenticationController.cs.

Versioning via URI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages