Skip to content

Instantly share code, notes, and snippets.

@vincentdesmares
Created September 11, 2017 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincentdesmares/a91def2be99693edc32dc45a9dc7d77f to your computer and use it in GitHub Desktop.
Save vincentdesmares/a91def2be99693edc32dc45a9dc7d77f to your computer and use it in GitHub Desktop.
A very simple example of how Sequelize works.
const Sequelize = require('sequelize');
const sequelize = new Sequelize('database', 'username', 'password');
const User = sequelize.define('user', {
username: Sequelize.STRING,
birthday: Sequelize.DATE
});
sequelize.sync()
.then(() => User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20)
}))
.then(jane => {
console.log(jane.get({
plain: true
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment