mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
sequelize sqlite
This commit is contained in:
13
rootfs_overlay/lkmc/nodejs/express.js
Executable file
13
rootfs_overlay/lkmc/nodejs/express.js
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const express = require('express')
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World!')
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`)
|
||||
})
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run mocha tests.
|
||||
npx mocha --require mocha_tests/global.js mocha_tests
|
||||
npx mocha --require mocha/utils.js mocha
|
||||
|
||||
@@ -3,7 +3,6 @@ var assert = require('assert');
|
||||
describe('describe0', function() {
|
||||
// Only runs before the current describe.
|
||||
before(async () => {
|
||||
myhelper();
|
||||
console.error('before describe 0');
|
||||
});
|
||||
beforeEach(async () => {
|
||||
@@ -15,8 +15,9 @@ exports.mochaHooks = {
|
||||
},
|
||||
};
|
||||
|
||||
// TODO don't know a better way to make this available
|
||||
// to test files than just requiring it by relative path.
|
||||
function myhelper() {
|
||||
console.error('myhelper');
|
||||
}
|
||||
|
||||
exports.myhelper = myhelper;
|
||||
1253
rootfs_overlay/lkmc/nodejs/package-lock.json
generated
1253
rootfs_overlay/lkmc/nodejs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,12 @@
|
||||
"description": "https://cirosantilli.com/linux-kernel-module-cheat#node-js",
|
||||
"main": "alphanumeric.js",
|
||||
"dependencies": {
|
||||
"mocha": "^8.3.2",
|
||||
"pg": "^8.5.1",
|
||||
"pg-hstore": "^2.3.3",
|
||||
"sequelize": "^6.5.1"
|
||||
"express": "4.17.1",
|
||||
"mocha": "8.3.2",
|
||||
"pg": "8.5.1",
|
||||
"pg-hstore": "2.3.3",
|
||||
"sequelize": "6.5.1",
|
||||
"sqlite3": "^5.0.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"scripts": {
|
||||
|
||||
@@ -17,11 +17,19 @@ const { Sequelize, DataTypes } = require('sequelize');
|
||||
// To use the URI syntax, we need an explcit username and password.
|
||||
// But the second constructor works with peer authentication.
|
||||
// https://stackoverflow.com/questions/46207155/sequelize-and-peer-authentication-for-postgres
|
||||
//
|
||||
// Fails
|
||||
//const sequelize = new Sequelize('postgres://user:password@localhost:5432/lkmc-nodejs')
|
||||
const sequelize = new Sequelize('lkmc-nodejs', undefined, undefined, {
|
||||
host: '/var/run/postgresql',
|
||||
dialect: 'postgres',
|
||||
logging: false,
|
||||
//
|
||||
// Works with peer authentication:
|
||||
//const sequelize = new Sequelize('lkmc-nodejs', undefined, undefined, {
|
||||
// host: '/var/run/postgresql',
|
||||
// dialect: 'postgres',
|
||||
// logging: false,
|
||||
//});
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: 'tmp.sequelize.sqlite',
|
||||
});
|
||||
|
||||
// OMG fuck this asynchronous bullshit:
|
||||
|
||||
Reference in New Issue
Block a user