A barebones Node.js app using Express 4.
Make sure you have Node.js and the Heroku CLI installed.
$ npm install
$ npm start
Your app should now be running on localhost:5000.
$ heroku create
$ git push heroku master
$ heroku open
or
To create data, use Sequelize seeders to bulk create your data:
- Edit the
config.json
file with local database name. - Create your models and migrate into database
- Create a seeder with
sequelize seed:create --name Seedername
- Update seeder to contain bulk create methods:
'use strict';
const data = [
{
username: 'John Doe',
password: 'password',
createdAt: '2017-07-04T02:05:01+00:00',
updatedAt: '2017-07-04T02:05:01+00:00'
},
{
username: 'John Doe1',
password: 'password',
createdAt: '2017-07-04T02:05:01+00:00',
updatedAt: '2017-07-04T02:05:01+00:00'
},
{
username: 'John Doe2',
password: 'password',
createdAt: '2017-07-04T02:05:01+00:00',
updatedAt: '2017-07-04T02:05:01+00:00'
}
];
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.bulkInsert('Users', data, {});
},
down: function (queryInterface, Sequelize) {
return queryInterface.bulkDelete('Users', null, {});
}
};
- Push the database to the Heroku database:
heroku pg:push myLocalDatabaseName DATABASE_URL --app herokuAppName