mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05: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
|
#!/usr/bin/env bash
|
||||||
# Run mocha tests.
|
# 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() {
|
describe('describe0', function() {
|
||||||
// Only runs before the current describe.
|
// Only runs before the current describe.
|
||||||
before(async () => {
|
before(async () => {
|
||||||
myhelper();
|
|
||||||
console.error('before describe 0');
|
console.error('before describe 0');
|
||||||
});
|
});
|
||||||
beforeEach(async () => {
|
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() {
|
function myhelper() {
|
||||||
console.error('myhelper');
|
console.error('myhelper');
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.myhelper = 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",
|
"description": "https://cirosantilli.com/linux-kernel-module-cheat#node-js",
|
||||||
"main": "alphanumeric.js",
|
"main": "alphanumeric.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mocha": "^8.3.2",
|
"express": "4.17.1",
|
||||||
"pg": "^8.5.1",
|
"mocha": "8.3.2",
|
||||||
"pg-hstore": "^2.3.3",
|
"pg": "8.5.1",
|
||||||
"sequelize": "^6.5.1"
|
"pg-hstore": "2.3.3",
|
||||||
|
"sequelize": "6.5.1",
|
||||||
|
"sqlite3": "^5.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -17,11 +17,19 @@ const { Sequelize, DataTypes } = require('sequelize');
|
|||||||
// To use the URI syntax, we need an explcit username and password.
|
// To use the URI syntax, we need an explcit username and password.
|
||||||
// But the second constructor works with peer authentication.
|
// But the second constructor works with peer authentication.
|
||||||
// https://stackoverflow.com/questions/46207155/sequelize-and-peer-authentication-for-postgres
|
// 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('postgres://user:password@localhost:5432/lkmc-nodejs')
|
||||||
const sequelize = new Sequelize('lkmc-nodejs', undefined, undefined, {
|
//
|
||||||
host: '/var/run/postgresql',
|
// Works with peer authentication:
|
||||||
dialect: 'postgres',
|
//const sequelize = new Sequelize('lkmc-nodejs', undefined, undefined, {
|
||||||
logging: false,
|
// host: '/var/run/postgresql',
|
||||||
|
// dialect: 'postgres',
|
||||||
|
// logging: false,
|
||||||
|
//});
|
||||||
|
const sequelize = new Sequelize({
|
||||||
|
dialect: 'sqlite',
|
||||||
|
storage: 'tmp.sequelize.sqlite',
|
||||||
});
|
});
|
||||||
|
|
||||||
// OMG fuck this asynchronous bullshit:
|
// OMG fuck this asynchronous bullshit:
|
||||||
|
|||||||
Reference in New Issue
Block a user