const Sequelize = require('sequelize');
const sequelize = new Sequelize('todo-subsecond', '', '', {
  dialect: 'postgres',
  logging: null
})

const TodoItem = sequelize.define('todo-item', {
  text: Sequelize.STRING,
})

module.exports = class DatabaseTodoList {

  async start(truncate) {
    await sequelize.sync()
    if(truncate) {
      await TodoItem.truncate()
    }
  }

  async addTodo({ text }) {
    await TodoItem.create({ text })
  }

  async getItems() {
    return TodoItem.all()
  }
}

@@ -33,21 +33,186 @@
 lize');%0A
-const
+%0Alet sequelize%0A%0Aif (process.env.DATABASE_URL) %7B%0A  sequelize = new Sequelize(process.env.DATABASE_URL, %7B%0A    dialect:  'postgres',%0A    protocol: 'postgres'%0A  %7D)%0A%7D else %7B%0A 
  sequeli
@@ -258,16 +258,18 @@
 , '', %7B%0A
+  
   dialec
@@ -283,16 +283,18 @@
 tgres',%0A
+  
   loggin
@@ -300,15 +300,20 @@
 ng: 
-null%0A%7D)
+false%0A  %7D)%0A%7D
 %0A%0Aco

Use DATABASE_URL if defined