-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (25 loc) · 936 Bytes
/
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
import dotenv from "dotenv";
dotenv.config({ path: "./config.env" });
import http from "http";
import https from "https"
import app from "./app.js";
import eventEmitter from "./utils/eventEmmiter.js";
import { sendMail } from "./utils/mailer.js";
import fs from "fs"
const options = {
key: fs.readFileSync('key.pem','utf-8'),
cert: fs.readFileSync('cert.pem','utf-8'),
ca:fs.readFileSync("csr.pem",'utf-8')
}
// const server = https.createServer(options,app);
const httpServer = http.createServer(app)
const PORT = process.env.port || 4000;
// console.log(process.env.user);
// console.log(process.env.NODE_ENV);
// sendMail("onotaizee@gmail.com", "HAHAHA", "Body blah blah blah")
app.set("port", PORT);
// Database connects first before server goes up and running
httpServer.listen(PORT,()=>{"Http server now running running"})
// server.listen(8443, () => {
// console.log(`https server running on port`);
// });