Skip to content

jaymistry4/dotnet-core-api

Repository files navigation


Logo

A simple, cross platform, modularized API system built on Microsoft .NET 7

An awesome .net 7 template to jumpstart your projects!
Explore the docs »

View Demo

Build Status

Table of Contents
  1. About The Project
  2. Features
  3. Getting Started
  4. Release History
  5. Contributors

About The Project

Asp Dot Net Core Web and API project with multiple features.

Built With

Microsoft .NET 7

(back to top)

Features

  • Microsoft .NET 7
  • Mongodb Database
  • MS SQL Database
  • API Pagination
  • Entity framework
  • Code first
  • Rate Limiting
  • Swagger (Library: Swashbuckle.AspNetCore 5.3.3)
  • Integration test (In memory, Actual database)
  • Unit test case with In Memory Database
  • Unit test case with Xunit
  • JWT token - Authorization Policy (Security Bearer Token)
  • Custom exception handling middleware (Global error handling)
  • Logger with NLog library
  • Cross Origin Request policy
  • Generic response for all the API calls

Example of generic api response:

{ "message": null, "didError": true, "errorMessage": "There was an internal error, please contact to technical support.", "model": null, "pageSize": 10, "pageNumber": 1, "itemsCount": 0, "pageCount": 1 }

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

1. Visual Studio 2022 or Visual Studio Code
2. SQL Server
3. Microsoft .NET 7
4. Mongodb Database

Link for .Net 7 download (https://dotnet.microsoft.com/download)

  • Change the xml documentation path.

Visual studio -> View menu -> DotNetCore.API properties -> Build -> Output -> XML documentation file: -> Here change the path of XML documentation

Current XML documentation path is: "bin\Debug\DotNetCore.API.xml"

  • Microsoft SQL Script

Folder: dotnet-core-api\DotNetCore.API\wwwroot\Database Script Script Name: WideWorldImporters.sql

  • Connecting Mongodb Server

Open file "appsettings.json" at the location: dotnet-core-api\DotNetCore.API\

Change the connection string value of "ConnectionBook" and "Connection" property.

(back to top)

Steps to run

  • Update the connection string in "appsettings.json" file in DotNetCore.API project
  • Restore packages
  • Build the whole solution
  • In Solution Explorer, make sure that DotNetCore.API is selected as the Startup Project
  • Create database, name it "WideWorldImporters"
  • Perform Migration or Use SQL script (WideWorldImporters.sql) to setup tables in database
  • In Visual Studio, press "Control + F5" or Run the program using command line

(back to top)

Release History

v0.2.0 (24-Sep-2022)

New features:
  • #1 .Net 7 version upgrade.
  • #2 Encryption Decryption api added.

v0.1.2 (02-Sep-2022)

New feature:
  • #1 Rate Limiting added.

v0.1.1 (01-Sep-2022)

New features:
  • #1 Mongodb Database connection added.

v0.1.0 (26-July-2022)

New features:
  • #1 .Net 6 version upgrade.

(back to top)

Contributors

Thanks goes to these wonderful people (emoji key):


Jay Mistry

🐛 💻 📖

(back to top)