const Sequelize = require('sequelize')
const sequelize = require('./model/sequelize')
// create table 'users' with model User
const User = sequelize.define('user', {
username: Sequelize.STRING,
birthday: Sequelize.DATE
})
// add user
sequelize.sync()
.then(() => User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20)
}))
.then(jane => {
console.log(jane.toJSON())
})
// more info
// http://docs.sequelizejs.com/class/lib/sequelize.js~Sequelize.html
run server
pm2
install pm2
npm install -g pm2
run server
pm2 start ecosystem.json
// reload all node
pm2 reload all
// reload node id is 1
pm2 reload 1
// start all node
pm2 start all
// start node id is 1
pm2 start 1
// stop all node
pm2 stop all
// stop node id is 1
pm2 stop 1
// get node status
pm2 status
// more
pm2 -h