Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sequelize example
const Sequelize = require('sequelize'),
epilogue = require('epilogue'),
express = require('express'),
bodyParser = require('body-parser');
// Define your models with Sequelize
// This is equivalent to defining Doctrine entities
let database = new Sequelize('database', 'root', 'password');
let User = database.define('User', {
username: Sequelize.STRING
// Create an Express server
let app = express();
app.use(bodyParser.urlencoded({ extended: false }));
// Plug Epilogue into Express
app: app,
sequelize: database
// Configure a REST resource endpoint with Epilogue
let userResource = epilogue.resource({
model: User,
endpoints: ['/users', '/users/:id']
// And that's it, GET/POST and DELETE will be available for your user entity.
app.listen(() => {
console.log('Server started!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment