-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.js
37 lines (33 loc) · 1.2 KB
/
app.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
"use strict";
var debug = require("debug")("my express app");
var express = require("express");
var path = require("path");
var favicon = require("serve-favicon");
var logger = require("morgan");
var cookieParser = require("cookie-parser");
var bodyParser = require("body-parser");
// App settings
var app = express();
app.use(favicon(__dirname + "/public/images/favicon.ico"));
app.use(express.static(__dirname+'/public'));
app.use(logger("dev"));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));
app.set("port", process.env.PORT || 8800);
// WebPage compling
const pug = require("pug");
const compiledFunction = pug.compileFile("./views/index.pug");
// Config
const config = require("./config")
app.get("/", (req, res) => {
console.log("Config fetched.")
res.send(compiledFunction({
git_root_file: config.repository_name, config: config.data
}))
})
var server = app.listen(app.get("port"), function () {
debug("Express server listening on port " + server.address().port);
});
console.log("Easy3DViewer is launched at: ", config["repository_name"])