noteserver

command module
v0.0.0-...-b3d9eb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 13 Imported by: 0

README

appserve donuts-are-good's followers donuts-are-good's stars donuts-are-good's visitors

noteserver

an http api serving notes. uses sqlite for storage.

setup

  • acquire dependencies: go get
  • compile: go build

usage

run the server

./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.
curl -H "Authorization: Bearer YOURTOKEN" https://note.rest/sync

post

  • add notes.
  • authorization: bearer token header.
  • payload: note objects in json array.
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.
curl https://note.rest/health

data

sqlite (notes.db) schema:


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

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL