A simple api to manipulate JSON objects. Powered by sinatra and rack. Lives on Heroku here
- Create: POST /api/objects
- Edit: PUT /api/objects/:uid
- Fetch: GET /api/objects/:uid
- Fetch all: GET /api/objects
- Remove: DELETE /api/objects/:uid
To set up locally
- Install ruby v2.7.0 and postgresql.
- To set up the postgreSQL DB, login to the postgres account (with
sudo su - postgreson linux based os). Runpsqlto access the DB terminal. Then, add a new user withcreate role simple_api with createdb login password 'veryGoodPassword';. - Back on your own account, clone the repo and run
bundle installinside the newly created folder. Then runbundle exec rake db:createto create the DB. - Because we don't want to hand out superuser accounts, at this point go back to the postgresql console and add the pgcrypto extension to the DB's we just created. This is done by
Then, again back in your own account and in the new project folder, run
\c simple_api_development; create extension pgcrypto; \c simple_api_test; create extension pgcrypto;
bundle exec rake db:setup. - Tests are run with
bundle exec rake test. - Start the server with
rackup -p [PORT] -s puma, where PORT is any port of your choice.