View listings for pet adoptions.
- .NET Core
- Node
- Yarn
- Editor, Preferably Visual Studio or Visual Studio Code
- Rescue Groups API Key
- Take a second to read the TOS before requesting an API key
If you are using VSCode, you should install the C# extension.
Create a file .env
in the root of the project, using the contents in .env.example
. Then, replace any variables with your own, such as RESCUE_GROUPS_API_KEY
with your own key.
The source code is broken up into a few different directories:
src/Api
exposes an API for retrieving animal listingssrc/Client
is a Blazor WebAssembly app that calls the Apisrc/Server
is more of an experiment. It is separate from Api and Client in that it is a Blazor Server app that does the work of both Api and Client.
There's a few ways you can start the app. Each way requires you to start the Api and Client separately.
- Basic
Start the Api in a terminal:
Then start the client in another terminal:
$ dotnet run -p src/Api info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:4001 info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:4000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /projects/PetAdoptions/src/PetAdoptions.Api
$ dotnet run -p src/Client info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:5001 info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /projects/PetAdoptions/src/PetAdoptions.Client
- Watch Mode, recompiles on files saved (recommended)
Both the Api and Client can be started in watch mode where the code is recompiled on file save. This is done by using
watch run debug
instead ofrun
:$ dotnet watch -p src/Api run debug watch : Started info: Microsoft.Hosting.Lifetime[0] Now listening on: https://localhost:4001 info: Microsoft.Hosting.Lifetime[0] Now listening on: http://localhost:4000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /projects/PetAdoptions/src/PetAdoptions.Api
- VSCode Debugger, allows setting breakpoints in code:
- Navigate to the Debug panel in VSCode and start the
.NET Core Launch (Api)
task. - There is currently not a debugger config for starting the Client, so you'll have to start the client using Basic or Watch.
- Navigate to the Debug panel in VSCode and start the
Once you've started the server, go to http://localhost:5000
in your browser.
After getting the client and server started, build the css using the following commands:
$ cd src/Client/wwwroot
$ yarn && yarn build
$ cd -
An index.css
file should have appeared in src/Client/wwwroot/css
.