Let's create a new file, models/notes-sequelize.mjs:
import fs from 'fs-extra';import util from 'util';import jsyaml from 'js-yaml';import Note from './Note';import Sequelize from 'sequelize';import DBG from 'debug';const debug = DBG('notes:notes-sequelize'); const error = DBG('notes:error-sequelize'); var SQNote; var sequlz;async function connectDB() { if (typeof sequlz === 'undefined') { const YAML = await fs.readFile(process.env.SEQUELIZE_CONNECT,'utf8'); const params = jsyaml.safeLoad(YAML, 'utf8'); sequlz = new Sequelize(params.dbname, params.username, params.password, params.params); } if (SQNote) return SQNote.sync(); SQNote = sequlz.define('Note', { notekey: { type: Sequelize.STRING, ...