diff --git a/docs/README.md b/docs/README.md index 9dfa3b6d..fa333bac 100644 --- a/docs/README.md +++ b/docs/README.md @@ -7,4 +7,5 @@ Below are all the documentation for how to do things in this codebase. The only - [`database.md`](./database.md) - [`testing.md`](./testing.md) - [`frontend.md`](./frontend.md) -- [`backend.md`](./backend.md) \ No newline at end of file +- [`backend.md`](./backend.md) +- [`run.md`](./run.md) \ No newline at end of file diff --git a/docs/run.md b/docs/run.md new file mode 100644 index 00000000..654e8e2f --- /dev/null +++ b/docs/run.md @@ -0,0 +1,30 @@ +# [`run.sh`](../run.sh) + +The [`run.sh`](../run.sh) contains all the commands you would ever want to run. + +You can easily call a function defined in the [`run.sh`](../run.sh) by calling + +```bash +sh run.sh +``` + +`` can be any one of these useful commands (I noted 👉 as the most useful/important in my opinion) + +| `` | what it does | +|---|---| +| `start` | 👉 Starts/runs the docker container | +| `stop` | 👉 Stops the docker container | +| `restart` | Stops, then Starts the docker container | +| `hard_restart` | 👉 Builds the docker container from scratch and starts it, do this if you're having errors | +| `gen_api` | 👉 Creates/Generates the frontend api code based on the backend endpoints | +| `reload_init_sql` | Reload/change the schema in [`init.sql`](../backend/init.sql)| +| `sql_dump` | Dumps the current db contents and schema into [`backups/`](../backend/data/backups/).| +| `psql` | Opens up a direct terminal into the database to execute SQL commands live | +| `test` | Runs all unit tests | +| `test_backend` | Runs only backend unit tests | +| `test_frontend` | Runs only frontend unit tests | + +There are actually many more functions, so please check out [`run.sh`](../run.sh). + + + diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index d7f48173..6e074192 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -8,7 +8,7 @@ let allEntries: ProteinEntry[] | null = null; onMount(async () => { // calls get_all_entries() from backend - // to generate this Backend object run `./run.sh api` for newly created server functions + // to generate this Backend object run `./run.sh gen_api` for newly created server functions allEntries = await Backend.getAllEntries(); }); diff --git a/run.sh b/run.sh index fbe88316..7ac795c2 100755 --- a/run.sh +++ b/run.sh @@ -2,6 +2,7 @@ # CALL STRUCTURE: sh run.sh # EXAMPLE: sh run.sh start +# more docs are in the docs/run.md file function all() { start @@ -31,7 +32,7 @@ function hard_restart() { } # generates the api bridge between frontend and backend -function api() { +function gen_api() { cd frontend yarn openapi && restart cd ..