https://github.com/jaredce/comparisontech
https://github.com/jaredce/comparisontech
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jaredce/comparisontech
- Owner: JaredCE
- Created: 2021-01-31T18:42:38.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-31T18:48:44.000Z (over 5 years ago)
- Last Synced: 2025-03-11T08:28:18.830Z (over 1 year ago)
- Language: JavaScript
- Size: 46.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
# Message Board
This uses pouchDB as it's data store. There should already be some generated data in the `/data/` folder, however, if this is missing run the following in a temrinal:
```
cd data
node index.js
cd ..
```
To run the API
```
npm ci --production
NODE_ENV=production node application.js
```
You can then call:
* GET: localhost:3000/v1/messages/messages/ to get all messages
* PUT: localhost:3000/v1/messages/message/ with a x-www-form-urlencoded body of `{title: 'abc', message: 'this is a message'}`
All other routes should 404.
To run tests:
```
npm i --save-dev
npm test
```
## Some design considerations
All routes should be authenticated, possibly by oAuth JWTs.
Data passed in and passed out should be validated using AJV for JSON schema validation. Data passed in should also be sanitised before adding to a database.
This should really run behind a web server that can offer rate limiting protection.