www 492 字节
Newer Older
J
Jason Park 已提交
1 2 3
#!/usr/bin/env node

const http = require('http');
J
Jason Park 已提交
4
const https = require('https');
J
Jason Park 已提交
5 6 7

const app = require('../app');
const {
J
Jason Park 已提交
8 9 10
  httpPort,
  httpsPort,
  credentials,
J
Jason Park 已提交
11 12 13
} = require('../environment');

const httpServer = http.createServer(app);
J
Jason Park 已提交
14 15 16 17 18 19 20 21
httpServer.listen(httpPort);
console.info(`http: listening on port ${httpPort}`);

if (credentials) {
  const httpsServer = https.createServer(credentials, app);
  httpsServer.listen(httpsPort);
  console.info(`https: listening on port ${httpsPort}`);
}