A Node.js/Koa implementation of the Rosetta String
Each example application must:
- Set a header of
x-powered-by
, with the value set as framework type/language - Connect to a common PostgreSQL database for string storage
- Use ENV variable
DATABASE_URL
connection string
- Use ENV variable
- Expose a web server
- Runnable via
./bin/www
- Runnable via
- Have a test suite
- Runnable via
./bin/test
- Runnable via
- Have an endpoint to declare the server
- via
GET /
- via
- Have an endpoint to return a string at random
- via
GET /random
- via
- Have an endpoint to add a new string
- via
POST /create
- This is protected by basic HTTP-Auth
- Password for basic auth is set by ENV variable
ROSETTA_PASSWORD
- Username for basic auth is
rosetta
- Set string/quote as POSTed body value for key
quote_text
- via
./bin/test
./bin/www
# Example creation of quote:
curl -i -X POST --url https://rosetta-string-nodejs-koa.herokuapp.com/create \
--header "Authorization: Basic base64string=" \
--data "quote_text=Strive for grace, not perfection."
# Example retrieval of quote:
curl -i --url https://rosetta-string-nodejs-koa.herokuapp.com/random