- API based response
- Markdown support
- Search
- Localized
- Git based and/or local articles storage
- Ristretto based cache (more cache backends coming soon)
- Multi-repository support
Edit the config/chronos.json
file to configure the server.
go run main.go
go build -o chronos main.go
./chronos
Chronos supports multiple repositories, both local and Git based. This allows you to have a single server for multiple projects or multiple repositories for a single project.
Repositories can be configured in the chronos.json
file as follows:
{
"port": "8080",
"gitRepos": [
{
"id": "vosDocs",
"url": "https://github.com/Vanilla-OS/documentation"
}
],
"localRepos": [
{
"id": "myAwesomeProject",
"path": "/myAwesomeProject/documentation"
}
]
}
Each repository must have a unique id
, Chronos requires it to identify the repository
when requesting articles.
Each local repository must contain an articles
folder with the following structure:
doumentation
├──articles
├─── en
│ └─── article1.md
└─── it
└─── article1.md
You can use a Git repositories as well, just add them to the GitRepos
array in the chronos.json
file,
Chronos will automatically clone them and update on each restart.
In the current version, automatic updates are not supported.
Get the status of the server.
- URL:
http://localhost:8080/
- Method: GET
- Response:
{
"status": "ok"
}
Check if a repository is available.
- URL:
http://localhost:8080/{repoId}
- Method: GET
- Response:
{
"status": "ok"
}
Get a list of articles, grouped by language.
- URL:
http://localhost:8080/{repoId}/articles/{lang}
- Method: GET
- Response:
{
"title": "repoId",
"SupportedLang": ["en", "it"],
"articles": {
"en": {
"articles_repo/articles/en/test.md": {
"Title": "Test Article",
"Description": "This is a test article written in English.",
"PublicationDate": "2023-06-10",
"Authors": ["mirkobrombin"],
"Body": "..."
}
},
"it": {
"articles_repo/articles/it/test.md": {
"Title": "Articolo di Test",
"Description": "Questo è un articolo di test scritto in italiano.",
"PublicationDate": "2023-06-10",
"Authors": ["mirkobrombin"],
"Body": "..."
}
}
}
}
Get a list of supported languages.
- URL:
http://localhost:8080/{repoId}/langs
- Method: GET
- Response:
{
"SupportedLang": ["en", "it"]
}
Get a specific article by providing its language and slug.
- URL:
http://localhost:8080/{repoId}/articles/en/test
- Method: GET
- Response:
{
"Title": "Test Article",
"Description": "This is a test article written in English.",
"PublicationDate": "2023-06-10",
"Authors": ["mirkobrombin"],
"Body": "..."
}
Search articles based on a query string.
- URL:
http://localhost:8080/{repoId}/search/{lang}?q=test
- Method: GET
- Response:
[
{
"Title": "Test Article",
"Description": "This is a test article written in English.",
"PublicationDate": "2023-06-10",
"Authors": ["mirkobrombin"],
"Body": "..."
}
]