Skip to content

Commit

Permalink
docs: add docs for the run.sh file
Browse files Browse the repository at this point in the history
  • Loading branch information
xnought committed Nov 15, 2023
1 parent 8d9efbc commit 24f5828
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
- [`backend.md`](./backend.md)
- [`run.md`](./run.md)
30 changes: 30 additions & 0 deletions docs/run.md
Original file line number Diff line number Diff line change
@@ -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 <cmd>
```

`<cmd>` can be any one of these useful commands (I noted 👉 as the most useful/important in my opinion)

| `<cmd>` | 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).



2 changes: 1 addition & 1 deletion frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
</script>
Expand Down
3 changes: 2 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# CALL STRUCTURE: sh run.sh <command>
# EXAMPLE: sh run.sh start
# more docs are in the docs/run.md file

function all() {
start
Expand Down Expand Up @@ -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 ..
Expand Down

0 comments on commit 24f5828

Please sign in to comment.