ソースを参照

something sort of working

master
mort 8年前
コミット
6a7b4e0f19
3個のファイルの変更36行の追加0行の削除
  1. 1
    0
      .gitignore
  2. 15
    0
      package.json
  3. 20
    0
      server.js

+ 1
- 0
.gitignore ファイルの表示

@@ -0,0 +1 @@
node_modules

+ 15
- 0
package.json ファイルの表示

@@ -0,0 +1,15 @@
{
"name": "ldsrv",
"version": "0.1.0",
"description": "Server thing for LD.",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "Martin Dørum Nygaard",
"license": "GPL-2.0",
"dependencies": {
"socksugar": "^0.2.0"
}
}

+ 20
- 0
server.js ファイルの表示

@@ -0,0 +1,20 @@
var SockSugar = require("socksugar");

var server = new SockSugar({
port: 8081
});

var sections = {};

server.on("connection", function(sock) {
console.log("connection");
sock.on("request", function(req) {
var parts = req.url.split("/");
var s = sections[parts[0]];

if (s === undefined)
return req.error("Not found");

s(parts, req);
});
});

読み込み中…
キャンセル
保存