A simple ASP.NET Core Web API for managing basic Contacts.
- You will need Visual Studio 2017 (15.8) and the .NET Core 2.1 SDK.
- The latest SDK and tools can be downloaded from https://dot.net/core.
- ASP.NET Core 2.1
- ASP.NET WebApi Core
- JWT Authentication
- Entity Framework Core 2.1
- .NET Core Native DI
- AutoMapper
- Swagger UI
- xUnit
- Moq
- Full architecture with separation of concerns, SOLID and Clean Code
- Repository and Generic Repository
- src/EvoContacts.API
- src/EvoContacts.ApplicationCore
- src/EvoContacts.Infrastructure
- tests/EvoContacts.IntegrationTests
- tests/EvoContacts.UnitTests
- Clone or download the project from GitHub.
- Open EvoContacts.sln in Visual Studio 2017.
- Build Solution.
- Select StartUp Project = EvoContacts.API.
- Select Debug Profile = IIS Express.
- Click Start Debugging or hit F5. Application will run and display Swagger UI.
- Use the Auth/token endpoint to request an OAuth authorization token.
- Click the "Authorize" button at the top of the UI. Enter "Bearer {Token}" into the Value field (without quotations and substituting the token you just received). Click "Authorize" to save and close the dialog.
- You should now be authorized to use all other endpoints.
Note that the application runs using an in-memory database by default.
If you wish to use a real SQL Server database complete the following steps:
- Uncomment EvoContacts.API\Startup.cs line 59 ConfigureProductionServices(services);
- Comment out EvoContacts.API\Startup.cs line 60 ConfigureTestingServices(services);
- Configure ConnectionString "DefaultConnection" in EvoContacts.API\appsettings.json line 6
- Configure ConnectionString "DefaultConnection" in EvoContacts.API\appsettings.Development.json line 6
- Open Package Manager Console window.
- Select Default project = "EvoContacts.Infrastructure".
- Type Update-Database into Package Manager Console and hit enter to apply migrations to the configured database.
- Re-run the application as detailed above.
This project was developed by Stephen Murphy.