Browse Source

something sort of working

master
mort 5 years ago
commit
6a7b4e0f19
3 changed files with 36 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 15
    0
      package.json
  3. 20
    0
      server.js

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
node_modules

+ 15
- 0
package.json View File

@@ -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 View File

@@ -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);
});
});

Loading…
Cancel
Save