- C# 100%
| .config | ||
| .vscode | ||
| src | ||
| .editorconfig | ||
| .gitignore | ||
| docker-compose.yml | ||
| openapi-client-config.json | ||
| README.md | ||
Froom
Setup
Ensure you have the following installed:
Local dev
-
Clone this repo to your local machine and
cd src -
Copy the
appsettings.Template.jsonto development file:cp appsettings.Template.json appsettings.Development.json -
Install local dotnet tools (e.g.
dotnet ef):dotnet tool restore -
Next, run any necessary migrations:
dotnet ef database updateNote
If this is an initial setup, the first time you run migrations you may see an error logged regarding the "EFMigrationsHistory" table. This is because it attempted to read from that table but it doesn't exist yet. This is expected, and the migrations should still proceed and complete successfully.
-
Start the API server in watch mode:
dotnet watch run- This will restart the web server whenever file changes are detected. Certain changes, like modifying server config, will require a full rebuild which you can run without interrupting watch by pressing
Ctrl+R.
- This will restart the web server whenever file changes are detected. Certain changes, like modifying server config, will require a full rebuild which you can run without interrupting watch by pressing
-
After the API is running, you should be able to access local swagger API explorer: http://localhost:5125/swagger/index.html
Migrations
Running migrations
To apply migrations, make sure your local postgres instance is running and run the following command:
dotnet ef database update
```****
### Rollback migrations
To rollback migrations, target the migration you wish to rollback to as the latest:
```bash
dotnet ef database update {nameOfMigrationToRollbackTo}
This next command will remove all migrations that are pending:
dotnet ef migrations remove
Creating a migration
When you add or modify entity properties, names, etc. you can generate a migration by running the following from the src directory:
dotnet ef migrations add NameOfTheMigration
The migration files will be generated in the Migrations folder, where you should inspect the generated code to ensure the migration was created as expected.
Client SDK
Working with the SDK locally
-
Make sure the API project is running, and from the project root pull the latest swagger.json:
wget -O openapi.json http://localhost:5125/openapi/froom.json -
Run the openapitools cli to generate the sdk, and then install dependencies and build:
rm -r sdk || true && docker run --user 1000:1000 -v "$PWD:/app" -w /app openapitools/openapi-generator-cli:latest-release /usr/local/bin/docker-entrypoint.sh generate -i openapi.json -g typescript-fetch -o sdk -c openapi-client-config.json && cd ./sdk && npm install && npm link && cd ../ -
Consume the linked package in the frontend project.
npm link @unfrl/froom-sdk