43 lines
1.8 KiB
Markdown
43 lines
1.8 KiB
Markdown
# Backend API
|
|
|
|
also known as `public`
|
|
|
|
## What is this?
|
|
|
|
This is a RESTful API service. Most of the data retrival, requesting, and processing happens here.
|
|
|
|
## Things you should know
|
|
|
|
### Environment variables
|
|
|
|
`public` uses a `.env` file at the root of the project. The file takes standard environment variables (like enviroment variables you would put into a `.bashrc` or ad-hoc into your shell).
|
|
|
|
For `public` to work properly, please make sure to first create the `.env` file, then fill out the following environment variables:
|
|
|
|
- `RUST_ENV` - needed for letting the service that we are working in either `development` or `production`
|
|
- `DATABASE_URL` - needed for connecting to Postgres
|
|
- `REDIS_URL` - needed for connecting to the cache (Redis or Valkey)
|
|
- `BASE_URI_WEB` - needed for connecting to the frontend user interface of the system to this service
|
|
|
|
### Gemini
|
|
|
|
Set `SERVE_APP=gemini` to run the existing Gemini TLS server on port 1965.
|
|
It uses `dev-cert.der` and `dev-key.der` in the working directory; database and
|
|
cache configuration is shared with HTTP mode. `BASE_URI_WEB` supplies links back
|
|
to the web site for RSS, the sitemap, contact forms, and posts without Gemtext.
|
|
|
|
The capsule follows the web site's navigation and page sections:
|
|
|
|
- `/`, `/contact`, `/health`
|
|
- `/posts`, `/posts/all`, `/posts/{id}`
|
|
- `/posts/featured`, `/posts/recent`, `/posts/popular`, `/posts/hot`
|
|
- `/authors`, `/authors/{id}`, `/authors/{id}/posts`
|
|
- `/projects`
|
|
- `/comments/index`, `/comments/post/{id}`
|
|
|
|
Author and comment indexes accept `?page=1&limit=12` (maximum limit 100).
|
|
Author pages include a biography and paginated post links. Article pages render
|
|
`body_gemtext` as Gemtext, with author, publication date, and featured status;
|
|
articles without it link to the HTML version. Comments are read-only, with a
|
|
link to the web page for participation.
|