No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
config
errors
gulp/deploy
lib
migrations
models
public
routes
seeds/dev
views
.eslintrc
.gitignore
README.md
app.js
gulp-deploy.js
gulpfile.babel.js
insecure.crt
insecure.key
knexfile.js
package.json
postinstall.js

README.md

Many to many relationship example with Bookshelf.js

This is a simple example of how to use many to many relationships with Bookshelf.js. This example was put together using Perk - a well documented set of tools for building node web applications.

This example was created for the Perk Documentation on many to many relationships

To run

  1. Git clone this repo
  2. cd into project and npm install
  3. Install knex: npm install -g knex
  4. With PostgreSQL: createdb many-to-many
  5. Boot up the server npm run dev
  6. Run migrations: knex migrate:latest
  7. Run seed files: knex seed:run
  8. Fill in database credentials and random string for session secret.
  9. Go to http://localhost:3000

Important files

Look at these files for the necessary pieces to establish a many to many relationship using Bookshelf.js.

Migrations

Models

Queries

Seed data