29 lines
770 B
JavaScript
29 lines
770 B
JavaScript
|
var fs = require('fs');
|
||
|
var http = require('http');
|
||
|
var https = require('https');
|
||
|
var privateKey = fs.readFileSync('sslcert/server.key', 'utf8');
|
||
|
var certificate = fs.readFileSync('sslcert/server.crt', 'utf8');
|
||
|
var credentials = {key: privateKey, cert: certificate};
|
||
|
|
||
|
var express = require('express');
|
||
|
var app = express();
|
||
|
|
||
|
// your express configuration here
|
||
|
|
||
|
var httpServer = http.createServer(app);
|
||
|
var httpsServer = https.createServer(credentials, app);
|
||
|
|
||
|
httpServer.listen(8080);
|
||
|
httpsServer.listen(8443);
|
||
|
|
||
|
|
||
|
//const express=require('express');
|
||
|
//const routes=require('./routes/api');
|
||
|
const dotenv=require('dotenv');
|
||
|
|
||
|
//var app = express();
|
||
|
|
||
|
//app.use('/',routes);
|
||
|
dotenv.config();
|
||
|
app.listen(process.env.PORT, ()=>console.log('Server Up Running'+process.env.PORT));
|