Selaa lähdekoodia

gitignore, added port option, tiny fixes

master
mortie 8 vuotta sitten
vanhempi
commit
c605553698
3 muutettua tiedostoa jossa 5 lisäystä ja 6 poistoa
  1. 1
    1
      .gitignore
  2. 2
    1
      conf.json.example
  3. 2
    4
      server.js

+ 1
- 1
.gitignore Näytä tiedosto

client/pic
conf.json

+ 2
- 1
conf.json.example Näytä tiedosto

{ {
"slides": "slides", "slides": "slides",
"interval": 5000
"interval": 5000,
"port": 8080
} }

+ 2
- 4
server.js Näytä tiedosto



function error(res, err) { function error(res, err) {
console.trace(err); console.trace(err);
console.log(res.toString());
res.end(err.toString());
} }


// The individual slide // The individual slide
.on("error", err => error(res, err)) .on("error", err => error(res, err))
.pipe(res); .pipe(res);
} else { } else {
console.log("loading "+parts.pathname+" from "+dir);
fs.createReadStream(pathlib.join(dir, parts.pathname)) fs.createReadStream(pathlib.join(dir, parts.pathname))
.on("error", err => error(res, err)) .on("error", err => error(res, err))
.pipe(res); .pipe(res);
var awaiters = []; var awaiters = [];


self.serve = function(req, res) { self.serve = function(req, res) {
console.log(currentSlide ? currentSlide.dir : "");
var parts = urllib.parse(req.url); var parts = urllib.parse(req.url);


// /: Send the base site to the client // /: Send the base site to the client


http.createServer((req, res) => { http.createServer((req, res) => {
slideshow.serve(req, res); slideshow.serve(req, res);
}).listen(8080);
}).listen(conf.port);

Loading…
Peruuta
Tallenna