Explorar el Código

support listing the availlable scripts.

Lucas Stadler %!s(int64=12) %!d(string=hace) años
padre
commit
bc730a6188
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      js/pixl/server.js

+ 6 - 0
js/pixl/server.js

@ -66,6 +66,12 @@ app.get('/load/:name', function(req, res) {
66 66
	})
67 67
});
68 68
69
app.get('/scripts', function(req, res) {
70
	var scripts = fs.readdirSync('./data/scripts');
71
	res.setHeader('Content-Type', 'text/plain');
72
	res.send(scripts.map(function(s) { return s.slice(0, s.length - 3); }).join("\n"));
73
});
74
69 75
app.get('/scripts/:name', function(req, res) {
70 76
  var file = req.params.name + '.js';
71 77
  var dir = './public';