An article JSON API with Bookshelf.js
Now supporting Postgresql + MySQL + SQLite.
Thanks To: knex migrations!
Create a pgfun
postgresql database.
createdb --encoding utf8 --owner postgres pgfun
Build the neccessary tables in for NODE_ENV=development
with
npm run migrations:dev
Start app with
npm run start
With cURL
curl -H "Content-Type: application/json"
http://localhost:3000/api/article -X POST -d '{"title": "Second",
"body": "Second article cause what the hell", "author": "ArchNoob"}'
With httpie
http localhost:3000/api/article title="Introduction" body="WHT"
author="ArchNoob"
With cURL
curl http://localhost:3000/api/article
With httpie
http localhost:3000/api/article
Check individual article with it's ID
http localhost:3000/api/article/0
http PUT localhost:3000/api/article/0 title="Introduction" body="What
the hell"
author="ArchNoob"
http DELETE localhost:3000/api/article/0
npm run tests
I'm learning knex, bookshelf & PG hope to intergrate it with these guys soon!
Peace!