Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arve0/commentsdb
dead simple comments database
https://github.com/arve0/commentsdb
Last synced: 8 days ago
JSON representation
dead simple comments database
- Host: GitHub
- URL: https://github.com/arve0/commentsdb
- Owner: arve0
- Created: 2016-06-12T21:49:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-11T22:23:32.000Z (about 1 year ago)
- Last Synced: 2024-04-11T07:27:25.983Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# commentsdb
Store medium-like comments in rethinkdb. Users first need to answer a captcha question and register their name before they are allowed to post comments. Name crashes are not allowed.## Config
See `config` in [package.json](package.json).## Start server
```sh
npm start
```## TODO
- write client
- report errors
- email?
- multiple captchas
- via package.json?
- cookie?## API
### GET `/captcha`
Get a captcha question:**Example response**:
```
Hva er en pluss en?
```### POST `/register`
Register name in the authors table. `captcha` must be correct and `name` must be unique.**POST-data**: `captcha`, `name`
**Responses**:
- **400**: Schema not validated. See [schema.js](schema.js).
- **401**: Wrong captcha.
- **409**: Name taken.
- **200**: Success. Sets a cookie with `author=id`.### GET `/comments/:page`
Get all comments for given page.**Responses**:
- **200**:```json
{ "page": "page.html",
"comments": [ {...}, ... ]
}
```### POST `/comment`
Store comment.**POST-data:** `page`, `paragraph`, `hash` and `comment`.
Example:
```sh
curl -d 'page=/scratch/index.html¶graph=3&comment=Hei!' localhost:3000/comment
```**Responses**:
- **403**: Not registered. See `/register` endpoint.
- **400**: Schema not validated. See [schema.js](schema.js).
- **200**: Success.### URL parameters
Parameters given as `/endpoint/:parameter` should be [URI encoded].### POST-data
POST-data should be [form-urlencoded] or [JSON].[URI encoded]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
[form-urlencoded]: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
[JSON]: http://stackoverflow.com/questions/7172784/how-to-post-json-data-with-curl-from-terminal-commandline-to-test-spring-rest?answertab=votes#tab-top