-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstaticRoutes.js
38 lines (31 loc) · 1.19 KB
/
staticRoutes.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
36
37
38
/* Static Files */
var fs = require("fs");
module.exports = function(app){
app.get('/prototypes/view/:id', function(request,response){
response.sendfile("static/prototypeView.html");
});
app.get('/tasks/view/:id', function(request,response){
response.sendfile("static/prototypeView.html")
});
app.get("/screens/:staticFilename", function (request, response) {
var imageData = fs.readFileSync("screens/"+request.params.staticFilename, "utf8");
response.send({
imageData: imageData,
success: true
});
});
/* Static File Server
* --------------------------------------------------------------------------*/
app.get("/static/:staticFilename", function (request, response) {
response.sendfile("static/" + request.params.staticFilename);
});
app.get("/static/css/:staticFilename", function (request, response) {
response.sendfile("static/css/" + request.params.staticFilename);
});
app.get("/static/js/:staticFilename", function (request, response) {
response.sendfile("static/js/" + request.params.staticFilename);
});
app.get("/static/img/:staticFilename", function (request, response) {
response.sendfile("static/img/" + request.params.staticFilename);
});
}