Browse Source

storage debug conf added

master
Christian Müller 10 years ago
parent
commit
884486329c
  1. 42
      .vscode/launch.json
  2. 4
      package.json
  3. 44
      src/storage.js

42
.vscode/launch.json vendored

@ -0,0 +1,42 @@
{
"version": "0.1.0",
// List of configurations. Add new configurations or edit existing ones.
// ONLY "node" and "mono" are supported, change "type" to switch.
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Launch storage.js",
// Type of configuration. Possible values: "node", "mono".
"type": "node",
// Workspace relative or absolute path to the program.
"program": "bin/storage.js",
// Automatically stop program after launch.
"stopOnEntry": false,
// Command line arguments passed to the program.
"args": [],
// Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
"cwd": ".",
// Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
"runtimeExecutable": null,
// Optional arguments passed to the runtime executable.
"runtimeArgs": ["--nolazy"],
// Environment variables passed to the program.
"env": {
"NODE_ENV": "development"
},
// Use JavaScript source maps (if they exist).
"sourceMaps": false,
// If JavaScript source maps are enabled, the generated code is expected in this directory.
"outDir": null
},
{
"name": "Attach",
"type": "node",
// TCP/IP address. Default is "localhost".
"address": "localhost",
// Port to attach to.
"port": 5858,
"sourceMaps": false
}
]
}

4
package.json

@ -25,6 +25,8 @@
"dependencies": { "dependencies": {
"express": "^4.13.3", "express": "^4.13.3",
"lru-cache": "^2.6.5", "lru-cache": "^2.6.5",
"marked": "^0.3.5" "marked": "^0.3.5",
"sequelize": "^3.8.0",
"sqlite3": "^3.1.0"
} }
} }

44
src/storage.js

@ -0,0 +1,44 @@
var redis = require("redis"),
client = redis.createClient({
return_buffers: true,
detect_buffers: false
});
var zlib = require('zlib');
var Sequelize = require('sequelize');
var sequelize = new Sequelize('database', null, null, {
dialect: 'sqlite',
pool: {
max: 5,
min: 0,
idle: 10000
},
storage: 'database.sqlite'
});
client.hget("note", "2015/7/12/hom", function (err, B) {
debugger
console.log("to unpack:", B.toString("base64"));
var R = zlib.gunzipSync(B);
console.log(R);
});
/*
var User = sequelize.define('User', {
username: Sequelize.STRING,
birthday: Sequelize.DATE
});
sequelize.sync().then(function() {
return User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20)
});
}).then(function(jane) {
console.log(jane.get({
plain: true
}))
});
*/
Loading…
Cancel
Save