This is an opinionated starter-kit for any ASP.NET Core API Server that uses MongoDB in the backend.
Not only as the backend datastore, but we are using MongoDB for user Authentication/Authorization via Identity Service as well, in the application.
The following steps assumes that you have MongoDB installed locaclly in your machine.
I prefer running mongodb with a config file like this: mongod --config ./mongod.cfg
, a sample config file is available in tools
directory.
For more information on installing and running MongoDB locally, refer this link.
I am currently using MongoDB Community Edition, 'version 3.6'.
Once MongoDB is installed and running,
- Checkout the repository
cd src/dbdriver
anddotnet restore
cd src/apiserver
anddotnet restore
- Create settings file for NLogger
cd src/apiserver/settings/logger-settings
- Rename
nlog.sample.config
tonlog.development.config
- Create settings file for API application
cd src/apiserver/settings/app-settings
- Rename
settings.sample.json
tosettings.development.json
export ASPNETCORE_ENVIRONMENT=Development
this will tell ASP.NET Core API Server to run in 'development' mode- cd
src/apiserver
and start the server:dotnet run localhost <your port# of choice>
- Perform step #1 to #4 above
- Make sure you have installed Docker and installed Docker-Compose
- Make sure you are in
src
directory - Run
docker-compose up
- Make the app deployable as a docker container
[✓]
- Add some more realistic features to the application
[✓]
- Admin Policies for more granular authorization
[✓]
- GET/POST/DEL/PUT/PATCH on some resources
[✓]
- Admin Policies for more granular authorization
- Add Unit Tests 😃