For a general idea of the app and its architecture, please read ARCHITECTURE.md
- .NET 8+ installed
- MySQL/MariaDB docker image instantiated and configured
- Nuget package manager
- Yarn package manager
-
Check
CompareHare.Api/appsettings.jsonfor connection details, ensure you create your MySQL container according to those specs, as such:docker run --detach -p 3307:3306 --name mariadb-matt -e MARIADB_ROOT_PASSWORD=P@ssw0rd! mariadb:latestalso, make sure to create 2 databases:comparehareandcomparehare-hangfire. If running for the first time, rundotnet ef database updatebefore runningdotnet run -
cd src/CompareHare.Reactthen runyarnto install dependencies. -
Run
yarn startto start the development server. It should automatically open the client in your browser when ready. -
Once the React app is up, you may then start the API, which both spins up the Web API server as well as the Hangfire background jobs, one of which (the offer loader job) will require a static resource that Webpack serves up for mocking purposes. (for now, in "production" it will scrape the legit URLs)
-
First, let's restore Nuget packages. Open a new terminal tab and
cd srcand then rundotnet restore -
Now, lets run any migrations.
cd CompareHare.Apithen (making sure the specified MySQL database is running - locally, Docker image)dotnet ef database update -
Finally, lets get this puppy running. Stay in the
CompareHare.Apifolder, then rundotnet run
I forgot how to do this, here's how:
-
Update all of the entities/relationships in
CompareHare.Domain -
If adding any new entities, you need to make sure the DbContext has an entry for them, or else Dotnet won't see them! Also, update DbContext with any relationship additions/changes.
-
In a terminal window,
cd src/CompareHare.Apithen run the command to generate a new migration based off a diff between the current schema and the changes:dotnet ef migrations add <YourMigrationNameHere> -
If you hit issues, tag a
--verboseon the end to debug the issue (very common - fix your code!) -
Once the migration Up/Down that was created is sufficient, run the migration:
dotnet ef database update(if this fails, ensure the dotnet tooling is installed:dotnet tool install --global dotnet-ef) -
If anything fails, you can select to rollback changes with
dotnet ef database update <FULL text name of last successful migration>(includes the numbers in the migration file name)
In order to see/trigger background jobs, go to http://localhost:53041/background-jobs when the API/Hangfire is running
-
Ensure all packages are restored:
cd srcthendotnet restore -
Then, you should be able to run all XUnit tests with
dotnet test -
TBD: Front end testing with Jest
- Getting "second selector undefined"? Yeah, this likely means you either fat-fingered the name of a base selector, OR, you need to stop and re-start
yarn startso it can run all of those goofy scripts that re-generates the index files (including reducers)