https://github.com/pruh/api
Simple Go REST API server in Go
https://github.com/pruh/api
dockerized golang mongodb rest-api
Last synced: 4 days ago
JSON representation
Simple Go REST API server in Go
- Host: GitHub
- URL: https://github.com/pruh/api
- Owner: pruh
- License: apache-2.0
- Created: 2018-01-30T18:03:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2026-05-20T04:20:13.000Z (5 days ago)
- Last Synced: 2026-05-20T06:13:15.195Z (5 days ago)
- Topics: dockerized, golang, mongodb, rest-api
- Language: Go
- Homepage:
- Size: 114 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# api

[](https://codecov.io/gh/pruh/api)
[](http://godoc.org/github.com/pruh/api)
REST API server written in Go. Supports basic HTTP auth.
## Usage
* Rename api.env.template to api.env and add correct its contents, such as Telegram BOT token, basic auth credential, etc.
* Run `docker-compose up -d` to start the server
## api.env
Simple key-value file which will be used by docker to set container environment variables.
* `PORT` mandatory port to use for service.
* `TELEGRAM_BOT_TOKEN` mandatory telegram bot token.
* `TELEGRAM_DEFAULT_CHAT_ID` default telegram chat ID, which will receive messages from the bot. This parameter is optinal.
* `API_V1_CREDS` username/password pairs in JSON format of users who are allowed to access API: `{"username1":"password1", "username2":"password2"}`. This parameter is optional.
## List of API methods
### Messages:
API to send messages.
* `/api/v1/telegram/messages/send` POST method which passes message to telegram. It accepts JSON in the following format:
```json
{
"message": "message to send",
"chat_id": 1234567890,
"silent": true
}
```
where `chat_id` is telegram chat id and `silent` is a flag indicating if message should be sent silently