Skip to content

fabiojansenbr/autorenter-api-aspnetcore

Repository files navigation

Build Status

AutoRenter - ASP.NET Core

An ASP.NET Core based implementation of the AutoRenter API.

Overview

These instructions will cover usage information for the API and the optional development virtual machine.

Frameworks - Packages - Patterns - Features used

  • ASP.NET Core
  • Entity Framework Core
  • FluentValidation
  • AutoMapper
  • Global exception handler
  • Cors
  • xUnit
  • Moq

Prerequisites

How To

  • 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.

Local Development

  1. Open the project folder in your favorite text editor (preferably VS Code).
  2. Run dotnet restore from the command line to restore dependencies.
  3. Run dotnet build to build the solution. a. Note: running will also build.
  4. To run api tests, navigate to a test folder (e.g., ./AutoRenter.Api.Tests) and run `dotnet test'.
  5. To run all api tests in Bash run './RunTests.sh'.
  6. Ensure the ASPNETCORE_ENVIRONMENT variable is set to development. On Windows: set ASPNETCORE_ENVIRONMENT=Development. On Unix based OS: export ASPNETCORE_ENVIRONMENT=Development.
  7. To run the app, navigate to the AutoRenter.Api folder and run dotnet run.

Browse the app

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.

API Route Documentation

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.

Docker Development

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

Troubleshooting

The app does not run

Make sure you have the correct version of ASP.NET Core:

dotnet --version

The supported version is 1.0.4

The project does not load in Visual Studio

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.

Contributing

Please read the CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Fusion Alliance for the initiative to create a community of open source development within our ranks.

About

An ASP.NET Core based implementation of the AutoRenter API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages