https://github.com/donuts-are-good/noteserver
backend api for note.rest
https://github.com/donuts-are-good/noteserver
api go golang notes rest rest-api
Last synced: 7 months ago
JSON representation
backend api for note.rest
- Host: GitHub
- URL: https://github.com/donuts-are-good/noteserver
- Owner: donuts-are-good
- License: mit
- Created: 2023-08-20T04:48:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-20T05:56:14.000Z (almost 3 years ago)
- Last Synced: 2025-02-14T20:56:36.392Z (over 1 year ago)
- Topics: api, go, golang, notes, rest, rest-api
- Language: Go
- Homepage: https://notes.rest
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README

  
# noteserver
an http api serving notes. uses sqlite for storage.
## setup
- acquire dependencies: `go get`
- compile: `go build`
## usage
run the server
```shell
./noteserver
```
listens on :4096.
## logs
logging for noteserver is managed through the system's syslog service. each log entry associated with noteserver is tagged with "notes-app".
## signals
noteserver listens for the sigint (interrupt) signal. when this signal is detected, the server begins its shutdown sequence, ensuring any pending operations are completed and the database connections are closed safely.
## notes
when interfacing with the api, particularly the `/sync` endpoint, authentication is managed via a bearer token provided in the request headers. it's expecting a 64 character string, hopefully a sha256 hash. if there's any issue with your request, such as authentication failures or malformed data, refer to the returned http status codes for insight.
## api
### /sync
**get**
- fetch notes.
- authorization: bearer token header.
- response: array of note objects.
```shell
curl -H "Authorization: Bearer YOURTOKEN" https://note.rest/sync
```
**post**
- add notes.
- authorization: bearer token header.
- payload: note objects in json array.
```shell
curl -X POST -H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" -d '[{"date": "2023-08-18", "title": "Title", "body": "Note body"}]' https://note.rest/sync
```
### /health
**get**
- server status.
- response: 200 ok if operational.
```shell
curl https://note.rest/health
```
## data
sqlite (notes.db) schema:
```sql
CREATE TABLE notes (
token TEXT,
id INTEGER PRIMARY KEY,
date TEXT,
title TEXT,
body TEXT
);
```
## license
mit license 2023 donuts-are-good, for more info see license.md