Quit It is a web app that I built as a proof of concept for a smoking cessation app. This version currently uses a .NET 10 web API and related JSON files to persist data entered from the front-end built with Svelte and SvelteKit.
I learned more about the C# language as well as Svelte and SvelteKit.
I think learned most about SOLID principles. DRY is a concept that I already understand and did my best to implement in this project.
There are plenty of items that could have been addressed differently.
- My CRUD functionality for "triggers" is very simple. I would have liked to add more properties to this object such as a property for how intense the trigger is.
- "Logs" are create and read only. The thought behind this was that it prevents the user from cheating. It may be wise to consider an accidental add that can be edited.
- There's still plenty of work for code clean-up that I'm not sure I'll have the time to accomplish before the deadline.
- I know that my limited knowledge of Svelte and SvelteKit prevents me from writing better code to handle requests. If I had time to explore it, I would have built a proxy api.
- I wanted to include charts built with ChartJS for more insights and display of historical data
| Tools |
|---|
| .NET 10 SDK |
| VS Code |
| C# Dev Kit VSCode Extension |
| NodeJS |
In GitBash, run the following commands to ensure that you have both the .NET 10 SDK and NodeJS. If these commands do not output a version number, please install the respective tool.
dotnet --versionnode -v
npm -vOnce you have verified that the .NET SDK is installed as well as NodeJS, open GitBash and cd into the directory of your choice to clone the project.
git clone https://github.com/dan-collins-dev/quit-it.gitcd into the Web-Api-Lab directory and run the following:
dotnet clean
dotnet buildIn your current terminal, run the following to start the web API:
dotnet run --project QuitIt.API/QuitIt.API.csprojAfter starting the server, open a new terminal and navigate back to the root of the project and run the following commands to start the Svelte app.
cd quit-it-svelte
npm install
npm run devAll icons were sourced from ionicons and SVG Repo.
Special thanks to LiminalElenyx for contributing to the reasons-to-quit-smoking-api.
To get a better idea of how Moq worked, I asked ChatGPT to generate a simple mock for GetAllLogs. This helped provide some more context as to how it worked and I was able to adapt it from there.
- Update controllers to return the appropriate status codes for POST, PUT, and DELETE.
- I updated the IsNewDay method after discovering a bug, but didn't update the unit test. While it still passes, it isn't truly testing the updated method.