0

I Have code like this.

const pino = require('pino')
const { Boom } = require('@hapi/boom')
const fs = require('fs')
const chalk = require('chalk')
require('dotenv/config')
const express = require('express')
const socket = require("socket.io");
const { toDataURL } = require('qrcode')
const mysql = require('mysql');
require('dotenv').config();
const request = require('request');
const { smsg } = require('./app_node/lib/myf')

const app = express()
const host = process.env.HOST
const port = parseInt(process.env.PORT)
app.use(express.urlencoded({ extended: true }))
app.use(express.json())
const ser = app.listen(port, host, () => {
    console.log(`Server is listening on http://${host}:${port}`)
})
const io = socket(ser);

how do i get my code to run on the https server

i want to run my server in https in nodejs

  • 1
    Node.js web apps are almost always behind a reverse proxy, and you should configure HTTPS there. Don't waste too much of your time. – Lex Li Jan 10 '23 at 23:52
  • https://stackoverflow.com/questions/11744975/enabling-https-on-express-js?rq=1 – Sanket Jan 11 '23 at 03:30

0 Answers0