I created this project to replace the Comic Vine API in a mobile app I was developing called Longboxit. The core of the server is using Node.js, Express.js, and Bookshelf.js.
I wrote a series of blog posts explaining how I initially set everything up and started building out endpoints. You can check it out at harrybaldwin.com.
The project uses 2 databases. The main MySQL database holds the Grand Comics Database and MongoDB holds the OAuth information. I did not want to try to add new tablse and data into the MySQL since I was going to have to update the data every month or so.
All requests require OAuth 2 client credentials grant type. The Making Requests section will have more information on using OAuth.
You will of course need Node.js installed. For initial development I used Node v4.4.4.
Note: The Gulp file will probably not work on Windows machines.
git clone reponpm install- Install MongoDB locally
- Next you will need to seed MongoDB with OAuth client data. Open mongo shell and run
use comicsapi-devand then rundb.clients.insertOne({clientId:'somerandomclientid', clientSecret: 'somerandomclientsecret', name: 'client name'});. - Install MySQL locally
- Download the latest Grand Comics DB dump and import into local MySQL.
npm install gulp -ggulp- ctrl+c to stop server. To make sure all processes are stopped you can run
gulp stopalso.
- Base64 encode clientid:clientsecret
- Use the base64 value in a POST request to /oauth/token
curl -X POST -H "Authorization: Basic generatedbase64value" -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=client_credentials' "http://localhost:8080/oauth/token"- This request will return an
access_tokenwhich you will now be able to use for any request to /api/* curl -X GET -H "Authorization: Bearer access_token" "http://localhost:8080/api/series/1571/"
GET /series
| Parameters | Required | Description |
|---|---|---|
| name | No | Search by Series name |
| limit | No | Limits results. Defaults to 10 |
| page | No | Page number that should be returned. Defaults to 1 |
GET /series/:id
GET /series:id/details
GET /series:id/brands
GET /series:id/indicia_publishers
GET /issues
| Parameters | Required | Description |
|---|---|---|
| series_id | No | Get Issues by series_id |
| barcode | No | Get Issues by barcode |
| limit | No | Limits results. Defaults to 10 |
| page | No | Page number that should be returned. Defaults to 1 |
GET /issues:id
gulp test