forked from purplemagma/starter-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
executable file
·30 lines (23 loc) · 806 Bytes
/
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
var port = 8001;
var localServerName = "localhost.intuit.com:"+port;
var express = require("express");
var https = require("https");
var path = require("path");
var fs = require("fs");
var cors = require("cors");
var app = express();
// all environments
app.set("port", process.env.PORT || port);
app.use(express.logger());
app.use(cors());
app.options("*", cors());
app.use("/", express.static(__dirname+"/src"));
if ("development" == app.get("env")) {
app.use(express.errorHandler());
}
var privateKey = fs.readFileSync("sslcert/server.key");
var certificate = fs.readFileSync("sslcert/server.crt");
var options = {key: privateKey, cert: certificate};
https.createServer(options, app).listen(app.get("port"), function(){
console.log("Visit https://localhost.intuit.com:"+app.get("port"));
});