Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marvin9/uptime-server-microservice
https://github.com/marvin9/uptime-server-microservice
Last synced: about 21 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/marvin9/uptime-server-microservice
- Owner: Marvin9
- Created: 2020-07-31T12:23:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-08T11:10:28.000Z (over 4 years ago)
- Last Synced: 2024-06-21T10:36:19.580Z (7 months ago)
- Language: Go
- Size: 77.1 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Uptime server API
[![Build Status](https://travis-ci.com/Marvin9/uptime-server-microservice.svg?token=VLAzbJP7VasfzqzWUHz9&branch=master)](https://travis-ci.com/Marvin9/uptime-server-microservice)> Monitor your server uptime easily.
## Run locally.
- Download dependencies.
```go mod download```
- Setup environment variables in ```.env``` file.
- ```PSQL_USER:postgres```
- ```PSQL_PASSWORD:password```
- ```DATABASE_NAME:uptime_server_service```
- ```DATABASE_URL:postgres://postgres@localhost:5432/uptime_server_service```
- ```JWT_KEY:secret_key```
- ```SENDGRID_API_KEY:your_sendgrid_api_key```
- ```COOKIE_DOMAIN:localhost```
- ```ALLOW_ORIGIN:http://localhost:3000```> NOTE: Update DATABASE_NAME & DATABASE_URL before running tests.
- Run.
```make dev```
OR
```go run main.go```- Test.
```make test```
```make verbose_test``` to debug tests.
## API
Endpoint
Method
Request Body
Response
Additional
/auth/register
POST
{
"email": string,
"password": string,
}
{
"email": bool,
"password": string,
}
/auth/login
POST
{
"email": string,
"password": string
}
{
"error": bool,
"message": string
}
Set jsonwebtoken in http cookie with expiration time of 30 minutes.
/auth/ping
GET
-
{
"email": string,
} ||
{
"error": boolean,
"message": string.
}
/api/instance
POST
{
"url": string,
"duration": int (time in nanoseconds)
}
{
"error": bool,
"data": string
}
Set monitor for url which will check in duration period and update database accordingly. Reflects in /api/report
/api/instances
GET
-
{
"error": bool,
"data": {
"url": string,
"duration": int,
"unique_id": string,
} || "message": "Unauthorized"
}
-
/api/report
GET
-
{
"error": bool,
"data": {
"url": string,
"status": int,
"reported_at": time,
"instance_id": string,
} || "message": "Unauthorized"
}
-
/api/instance
DELETE
{
"instance_id": string,
}
{
"error": bool,
"message": string
}
-