Skip to content

Simple REST API with a MySQL database built using express.js and bookshelf.js

Notifications You must be signed in to change notification settings

paulinakiendys/photo-api

Repository files navigation

photo-api

Simple REST API with a MySQL database built using express.js and bookshelf.js.

Table of contents

Requirements

  • RESTful
  • MVC framework
  • Use Bookshelf as ORM
  • Authentication using JWT tokens
  • Hashing/salting of passwords using bcrypt
  • Data validation using express-validator
  • All responses must be wrapped according to the JSend specification
  • All queries and responses must follow the structure specified for each endpoint
  • Error handling
  • Use correct HTTP status codes
  • Deployed to Heroku

Specification

User

Register new user
Log in to get a JWT token

Photos

List photos
Create a new photo
Update a photo
Delete a photo (and any links between photo and albums)

Album

List albums
Create a new album
Update an album
Delete an album (and any links between album and photos)

Album > Photos

List photos in album
Add photo(s) to an album
Delete a photo from an album

Models

Model sketch

Album

Attributes: title

Relations: photos, user

Photo

Attributes: title, url, comment (default null)

Relations: albums, user

User

Attributes: email, password, first_name, last_name

Relations: albums, photos

Timeline

2 weeks