eolas-api/README.md

167 lines
3.1 KiB
Markdown
Raw Normal View History

2025-12-08 17:42:14 +00:00
# eolas-api
2025-10-15 15:01:32 +01:00
2025-12-08 17:42:14 +00:00
API written in NodeJS that queries my Zettelkasten, Eolas.
2025-12-08 17:42:14 +00:00
It is a constituent part of my knowledge management system comprising [eolas](https://forgejo.systemsobscure.net/thomasabishop/eolas),
[eolas-db](https://forgejo.systemsobscure.net/thomasabishop/eolas-db), and [eolas-app](https://forgejo.systemsobscure.net/thomasabishop/eolas-app).
2025-12-08 17:42:14 +00:00
The application reads from an SQLite database managed via [eolas-db](https://forgejo.systemsobscure.net/thomasabishop/eolas-db).
2025-12-08 17:42:14 +00:00
## Local development
2025-12-08 17:42:14 +00:00
```sh
npm install
npm run start
```
2025-12-08 17:42:14 +00:00
This will start the local server at `http://localhost:4000`. It will look for
stub database at `/data/eolas.db`.
2025-12-08 17:42:14 +00:00
## Deployment
2025-12-08 17:42:14 +00:00
The API is deployed to my remote VPS, residing at `/var/www/eolas-api`. The
database that it reads from is located at `/data/sqlite/eolas/eolas.db`.
2025-12-08 17:42:14 +00:00
Deployment is automated via [Forgejo action](https://forgejo.systemsobscure.net/thomasabishop/eolas-api/src/branch/main/.forgejo/workflows/deploy.yaml). Deployment actions are always executed by the `deploy` user on the VPS.
2025-12-08 17:42:14 +00:00
The action script transfers the source files to the VPS and installs necessary
packages. It also restarts the `eolas-api` systemd service on the VPS.
### `systemd` service
2025-12-08 17:42:14 +00:00
On the VPS, `eolas-api` runs as a `systemd` service. See the
[unit file](./systemd/eolas-api.service) for details.
2025-10-15 17:14:08 +01:00
## API
### Entries
#### Get all entries
Return all entries. Optionally limit by length and/or date.
```
GET /entries?limit=2&sort=date
```
```json
{
"count": 5,
"data": [
{
"title": "SSH",
"last_modified": "2025-07-10 14:26:04"
},
{
"title": "List_largest_files_bash",
"last_modified": "2025-07-07 16:49:12"
}
]
}
```
#### Get specific entry
```
GET /entries/Memory_versus_processor
```
```json
{
"title": "Memory_versus_processor",
"last_modified": "2024-10-18 19:17:01",
"size": 270,
"body": "# Memory versus processor\n\n Would a more powerful processor with average or reduced memory capacity..."
}
```
#### Get backlinks for an entry
Defaults to alphabetic list.
```
GET /entries/backlinks/The_kernel
```
```json
{
"count": 3,
"data": ["Boot_process", "Containerization", "CPU_architecture"]
}
```
#### Get outlinks for an entry
Defaults to alphabetic list.
```
GET /entries/outlinks/The_kernel
```
```json
{
"count": 3,
"data": ["Basic_model_of_the_operating_system", "Processes", "User_Space"]
}
```
#### Get entries associated with a specified tag
Optionally sort chronologically.
```
GET /entries/tag/memory?sort=date
```
```json
{
"count": 3,
"data": [
{
"entry_title": "Memory_addresses"
},
{
"entry_title": "Call_stack"
},
{
"entry_title": "The_memory_hierarchy"
}
]
}
```
### Tags
#### Get all tags
Sorted alphabetically.
```
GET /tags
```
```json
{
"count": 119,
"data": ["algebra", "algorithms", "analogue", "android", "..."]
}
```
#### Get tags for specified entry
2025-10-09 18:53:31 +01:00
```
GET /tags/The_kernel
```
2025-10-09 18:53:31 +01:00
```json
{
"count": 4,
"data": [
"computer-architecture",
"memory",
"operating-systems",
"systems-programming"
]
}
```