Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DefinitelyADev committed Sep 12, 2021
1 parent 954af09 commit bffff3a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CurrencyApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Src\CurrencyApi.Migrations\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CurrencyApi.Migrations", "CurrencyApi.Migrations", "{CF4E38DE-AE19-4581-A77C-CD2C0C9B3A5A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EB29CA49-E3ED-4498-A4B7-3C28A0CC0071}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Currency API

A RESTful API for managing and calculating currency rates built using .Net 5.

## Data settings

In order to run this application, you'll need to edit the `appDataSettings.json` file.

Example data configuration file:

```json
{
"ConnectionString": "Server=127.0.0.1;Port=3306;Database=currency_api;AllowUserVariables=True;User Id=root;",
"DataProvider": "MySql",
"EnableSensitiveDataLogging": true,
"RawDataSettings": {}
}
```
* The connection string should be in the format supported the respective provider. [More info](https://www.connectionstrings.com/)
* The supported providers are `MySql`, `SqlServer` and `Postgres`.

## Using

### Windows

1. Download the windows archive from the releases page
2. Extract the downloaded archive to the desired directory
3. Replace {publish dir} with the export directory and run the following command

```ps
env:DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1; {publish dir}/CurrencyApi.Presentation.exe --urls http://127.0.0.1:5000
```
### Linux

1. Download the linux archive from the releases page
2. Extract the downloaded archive to the desired directory
3. Replace {ver} with the downloaded version and {publish dir} with the export directory
4. Run the following commands

Install dependencies: `unzip`

```bash
unzip currency-api-v{ver}-linux-amd64.zip -d {publish dir}
chmod +x {publish dir}/CurrencyApi.Presentation
cd {publish dir}
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 ./CurrencyApi.Presentation --urls http://127.0.0.1:5000
```

Next [After run](#after-run)

## Running from source

Note: When running in debug mode the migrations have to be applied manually.
To apply the migrations manually please run the following command, in the parent directory of the project.
```dotnetcli
dotnet ef database update --startup-project .\Src\CurrencyApi.Presentation\
```
More info: [Entity Framework Core tools reference - .NET Core CLI](https://docs.microsoft.com/en-us/ef/core/cli/dotnet)

## After run

After starting the application you should be automatically directed at the swagger ui. If this doesn't happen you can navigate manualy by typing {BaseUrl}/swagger in your preferred browser.

In order to use the api you must first login.
The default credentials are:

* Admin user:
- username: `admin`
- password: `defaultAdminPass1!`

* Simple user:
- username: `user`
- password: `defaultUserPass1!`

0 comments on commit bffff3a

Please # to comment.