added https withe self sign ssl to backentd and healthcheck to frontend
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import dotenv from 'dotenv';
|
||||
import fs from 'fs';
|
||||
import https from 'https';
|
||||
import express from 'express';
|
||||
import cors from 'cors';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import apiRouter from './api.js';
|
||||
@@ -12,6 +15,7 @@ const app = express();
|
||||
|
||||
db.initDB();
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json())
|
||||
app.use(express.urlencoded({ extended: true }))
|
||||
//app.use(express.static(path.join(__dirname, "public"), {
|
||||
@@ -19,6 +23,11 @@ app.use(express.urlencoded({ extended: true }))
|
||||
//}));
|
||||
app.use("/api", apiRouter);
|
||||
|
||||
const server = app.listen(5555, () => {
|
||||
const options = {
|
||||
key: fs.readFileSync('server.key'),
|
||||
cert: fs.readFileSync('server.cert')
|
||||
};
|
||||
|
||||
const server = https.createServer(options, app).listen(5555, () => {
|
||||
console.log(`Server running on http://localhost:${server.address().port}`);
|
||||
});
|
||||
Reference in New Issue
Block a user