An ASP.NET Core based implementation of the AutoRenter API.
These instructions will cover usage information for the API and the optional development virtual machine.
- ASP.NET Core
- Entity Framework Core
- FluentValidation
- AutoMapper
- Global exception handler
- Cors
- xUnit
- Moq
- Download and install .NET Core 1.0
- Unless otherwise noted, all terminal commands must be issued from the solution's root directory.
- See the Azure Deployment Guide for information on deploying the project to Azure.
- Open the project folder in your favorite text editor (preferably VS Code).
- Run
dotnet restore
from the command line to restore dependencies. - Run
dotnet build
to build the solution. a. Note: running will also build. - To run api tests, navigate to a test folder (e.g.,
./AutoRenter.Api.Tests
) and run `dotnet test'. - To run all api tests in Bash run './RunTests.sh'.
- Ensure the ASPNETCORE_ENVIRONMENT variable is set to development. On Windows:
set ASPNETCORE_ENVIRONMENT=Development
. On Unix based OS:export ASPNETCORE_ENVIRONMENT=Development
. - To run the app, navigate to the
AutoRenter.Api
folder and rundotnet run
.
After successfully starting the API app, you should be able to view data by browsing to http://127.0.0.1:3000/api/locations.
Note that in some cases the port number may be something other than 3000. For example, in my development environment the app runs on port 5000. This is what appears in my console when the app is launched:
Now listening on: http://localhost:5000
.
For more in-depth testing, use a web debugging tool such as Fiddler or Postman.
Once running locally, you can access API route documentation (useful for those consuming the API) by going to: http://localhost:3000/docs/api/
NOTE: The adjust the port as necessary. For example, the app runs on port 5000 in my development environment.
Note: If you want to use Docker, you will need to point your browser (and Postman, if you use it) to 192.168.99.100:3000 instead of 127.0.0.1:3000.
To build and start the app:
docker build -t autorenter-api-image .
docker run -d -p 3000:3000 --name autorenter-api autorenter-api-image
To connect to the container:
docker attach --sig-proxy=false autorenter-api
To clean up the container once your done with it:
docker stop autorenter-api
docker rm autorenter-api
docker rmi autorenter-api-image
Make sure you have the correct version of ASP.NET Core:
dotnet --version
The supported version is 1.0.4
The Microsoft Documentation says that this will work with Visual Studio Update 3. Not so. The project file format has been changed from a JSON-based format to an XML-based format (allegedly to maintain compatibility with MSBuild). However, VS Update 3 does not yet support this new format. Consider using Visual Studio 2017 or Visual Studio Code.
Please read the CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning.
This project is licensed under the MIT License - see the LICENSE file for details
- Fusion Alliance for the initiative to create a community of open source development within our ranks.