Skip to content

Instantly share code, notes, and snippets.

@vdeturckheim vdeturckheim/db.js
Created Feb 4, 2018

Embed
What would you like to do?
const DB_NAME = 'tests-express-sqlite';
const Fs = require('fs');
const Path = require('path');
const Sqlite = require('sqlite3');
try {
Fs.unlinkSync(`./${DB_NAME}`);
}
catch (_ign) {}
const DB = new Sqlite.Database(DB_NAME);
const init = Fs.readFileSync(Path.join(process.cwd(), './database/init.sql'), 'utf-8');
DB.exec(init);
module.exports = DB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.