diff options
author | dan <[email protected]> | 2023-05-16 10:35:39 -0400 |
---|---|---|
committer | dan <[email protected]> | 2023-05-16 10:35:39 -0400 |
commit | d5b55156cd316e2c121681a33182cc39abf05d2c (patch) | |
tree | f44e0a85e9dfb127823d482a31f3c1a35a23c009 /readme.md | |
parent | b416c82ecc9ac8a94d059338c488507229d0996c (diff) | |
download | simple-comments-widget-d5b55156cd316e2c121681a33182cc39abf05d2c.tar.gz simple-comments-widget-d5b55156cd316e2c121681a33182cc39abf05d2c.tar.bz2 simple-comments-widget-d5b55156cd316e2c121681a33182cc39abf05d2c.zip |
docs: improve readme, add high level explanation
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,9 +1,19 @@ ## simple-comments-widget -Two parts, a server `main.scm`, written in Chicken Scheme, and a frontend written in html+js+css. +This is a comments component for adding to web pages, plus a backend service that stores comments in a database. + +Users can delete their own comments, but the server does not save any user information. This is acheived by generating a key for every new comment, which is cached in the browser of the creator, and also stored in the server's database. Deletion REST requests must include this number, as well as the comment's id. + +### Server REST API + +- `GET /comments?page_id=add-page-id-here` : returns a json array of comments for the page 'add-page-id-here'. +- `POST /comments` : takes a json body of the form `{"bot":"no", "content": "foo bar", "deletion_key": "3858516384593962266", "page_id":"add-page-id-here"}`. Creates a comment and returns plain text containing the id of the new comment. +- `DELETE /comments?comment=168424640753280&deletion_key=3858516384593962266` : deletes the comment with the provided id (`comment`) and `deletion_key`, if it exists (has no effect if no such comment exists). Should always return `204`. ### Running the application +The system has two parts, a server `main.scm`, written in Chicken Scheme, and a frontend written in html+js+css. + To start the server, run `make run`. To start the client, open `client.html` in a web browser. |