44 lines
1.0 KiB
Markdown
44 lines
1.0 KiB
Markdown
# us.dev Generalized API
|
|
|
|
AKA _the monolith_
|
|
|
|
## Quickstart
|
|
|
|
Dependencies:
|
|
|
|
- Docker
|
|
- Node 18
|
|
|
|
```sh
|
|
# Copy example .env
|
|
cp .env.example .env
|
|
# Install Dependencies
|
|
yarn
|
|
# Start local services
|
|
docker compose up -d
|
|
# Start Application
|
|
yarn start:dev
|
|
# Log in with development user (admin) and dev password (password)
|
|
curl --request POST \
|
|
--url http://localhost:3000/auth/login \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{
|
|
"username":"admin",
|
|
"password":"password"
|
|
}'
|
|
```
|
|
|
|
The Login command will return a JSON object with `access_token`. You can then
|
|
head over to http://localhost:3000/api, click the "Authorize" button, and enter
|
|
the `access_token`. This will then be applied to all of the endpoints that
|
|
require auth on the API page.
|
|
|
|
## Configuration
|
|
|
|
Supply the following environment variables:
|
|
|
|
| Env Name | Description |
|
|
| ---------- | ------------------------------------------- |
|
|
| JWT_SECRET | A big string to use as the JWT token secret |
|
|
| ADMIN_PASS | The password for the `admin` user |
|