-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
35 lines (33 loc) · 1.04 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Webpack
var webpack = require('webpack');
var config = require('./webpack.config');
var WebpackDevServer = require('webpack-dev-server');
var redis = require("redis");
var client = redis.createClient();
// Dev Server
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(1337, 'localhost', function (err, result) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:1337');
});
// Redis Database
// code was C&P from http://redis.js.org/ USAGE EXAMPLE
client.on("error", function (err) {
console.log("Error " + err);
});
// Database testing
client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
console.log(replies.length + " replies:");
replies.forEach(function (reply, i) {
console.log(" " + i + ": " + reply);
});
client.quit();
});