framez-server/framez-server.js
2018-04-27 15:23:19 +03:00

26 lines
677 B
JavaScript

const express = require('express')
const https = require('https');
//
// Config
const Config = require('./Server/Config/Config');
// Routers
const APIRouter = require('./Server/API/API');
// App
const app = express()
app.use('/api', APIRouter);
if(Config.server.enableSSL){
// HTTPS server
app = https.createServer({
key: fs.readFileSync(Config.server.ssl.key),
cert: fs.readFileSync(Config.server.ssl.cert),
passphrase: fs.readFileSync(Config.server.ssl.passphrase)
}, app);
}
app.listen(Config.server.port,function(){
console.log(`Running an ${(Config.server.enableSSL) ? 'HTTPS' : 'HTTP'}, and listening on port ${Config.server.port}`);
});