-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
56 lines (37 loc) · 1.44 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const express = require("express");
const fs = require("fs")
const app = express();
var rh = fs.readFileSync(__dirname+"/config.production.json", "utf-8");
var prod = JSON.parse(rh);
prod.server.port = process.env.PORT || 4000;
if (process.env.PORT) {
prod.url = "http://localhost:"+process.env.PORT;
prod.server.host = "127.0.0.1"
} else {
prod.url = "http://localhost:4000";
prod.server.host = "localhost";
}
prod.database.connection.filename = __dirname+"/ghost.db";
prod.paths.contentPath = __dirname+"/content";
fs.writeFileSync(__dirname+"/config.production.json", JSON.stringify(prod, 0, 2));
fs.writeFileSync(__dirname+"/config.development.json", JSON.stringify(prod, 0, 2));
console.log("content path ", __dirname)
console.log(fs.readdirSync(__dirname))
console.log("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
app.get("/", (req, res) => {
res.send(fs.readFileSync(__dirname+"/config.production.json", "utf-8"))
})
//app.listen(process.env.PORT)
var ghost = require('ghost');
ghost().then((ghostServer) => {
console.log("ghost running", prod.server)
//console.log(Object.keys( ghostServer.config) )
//app.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
ghostServer.start();
});
//app.get("/", (req, res) => {
// res.send("Online "+ Date.now() )
//})
//app.listen(process.env.PORT || 4000, () => {
// console.log("listening on ", (process.env.HOST||"http://localhost")+":"+(process.env.PORT||4000))
//})