This is a demo CRUD application providing a REST API for currencies, currency rates & users (authentication & authorization)
-
Clone the repo
git clone https://github.com/Predatoroid/currency-calculator.git
-
Database: You can leave the settings as is in appsettings.json:
{ ... "ConnectionStrings": { "DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=CurrencyCalculatorDB;Trusted_Connection=True;" } }
or if you use a different database in SQL Server, navigate to
CurrencyCalculator.API
and run the below command in terminal:dotnet ef database update
-
Navigate to
CurrencyCalculator.API
in order to run the API (make sure that you have installed .NET Core 3.1 Runtime & SDK):dotnet run
-
Navigate to Swagger UI to see the available endpoints that are described in documentation
-
Send a POST request in
api/auth/login
with the below body (NOTE: The Media type has to be application/json):{ "username": "admin", "password": "123456" }
{ "username": "testuser", "password": "123456" }
-
From the response of the above request, you will receive a token:
{ ... "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjhlMGQzODY0LWRhMmEtNGM2NS04NDMzLTJiYjBjYzExZDcyNCIsInJvbGUiOiJhZG1pbiIsIm5iZiI6MTYyMTMyNzk1MiwiZXhwIjoxNjIxMzU2NzUyLCJpYXQiOjE2MjEzMjc5NTJ9.NnJMUbPA27L6ay_QISAcuJm1Hm1-UJvzCGF4xMe7glQ", ... }
-
Click on "Authorize" button and copy/paste the token with the value:
Bearer {token}
-
Now as an authorized user, you can send any request that you want
- Navigate to
Postman configuration
- Import the environment & collection files in Postman
- Test the API
See the open issues for a list of proposed features (and known issues).
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Fotis Dimitrakopoulos - [email protected]
Project Link: https://github.com/Predatoroid/currency-calculator