forked from mirrors/pronouns.cc
add dev instructions to README
This commit is contained in:
parent
1c8276188c
commit
683d61bd82
1 changed files with 30 additions and 0 deletions
30
README.md
30
README.md
|
@ -25,6 +25,36 @@ Both the backend and frontend are expected to run behind a reverse proxy such as
|
||||||
The frontend should serve every possible path _except_ anything starting with `/api/`, which should be routed to the backend instead.
|
The frontend should serve every possible path _except_ anything starting with `/api/`, which should be routed to the backend instead.
|
||||||
**Make sure to rewrite requests going to the API server to remove the starting `/api/`.**
|
**Make sure to rewrite requests going to the API server to remove the starting `/api/`.**
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
- Go 1.18 or later
|
||||||
|
- PostgreSQL (any currently supported version should work)
|
||||||
|
- Redis 6.0 or later
|
||||||
|
- Node.js (latest version)
|
||||||
|
- MinIO **if testing uploads** (_not_ required otherwise)
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
1. Create a PostgreSQL user and database (the user should own the database)
|
||||||
|
For example: `create user pronouns with password 'password'; create database pronouns with owner pronouns;`
|
||||||
|
2. Create a `.env` file in the repository root containing at least `HMAC_KEY`, `DATABASE_URL`, `REDIS`, `PORT`, and `MINIO_ENDPOINT` keys.
|
||||||
|
(See below for an example)
|
||||||
|
3. Run `make migrate` to initialize the database, then optionally `make seeddb` to insert a test user.
|
||||||
|
4. Run `go run -v ./backend` to run the backend.
|
||||||
|
5. Create `frontend/.env` with the following content: `API_BASE=http://localhost:8080`
|
||||||
|
6. cd into the `frontend` directory and run `yarn dev` to run the frontend.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Example env file
|
||||||
|
HMAC_KEY="`go run -v ./scripts/genkey`"
|
||||||
|
DATABASE_URL=postgresql://<username>:<pass>@localhost/<database> # PostgreSQL database URL
|
||||||
|
REDIS=localhost:6379
|
||||||
|
PORT=8080 # Port the API will listen on. Default is 8080, this is also default for the backend.
|
||||||
|
MINIO_ENDPOINT=localhost:9000 # This always needs to be set, it *does not* need to point to a MinIO server.
|
||||||
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Copyright (C) 2022 Sam <u1f320>
|
Copyright (C) 2022 Sam <u1f320>
|
||||||
|
|
Loading…
Reference in a new issue