Skip to content

Commit

Permalink
add host usage
Browse files Browse the repository at this point in the history
  • Loading branch information
wassfila committed Apr 13, 2024
1 parent 69a4b11 commit bb135c9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ app.use((req, res, next) => {
res.status(404).send("Sorry can't find that!")
})



console.log(`listening on ${protocol}://${host}:${port}`)


if(protocol == "https"){
const key = readFileSync(join(__dirname, process.env.KEY_FILE),'utf8')
const cert = readFileSync(join(__dirname, process.env.CERT_FILE),'utf8')
const httpsServer = https.createServer({key,cert},app)
httpsServer.listen(port);//443 for clear url
const key = readFileSync(join(__dirname, process.env.KEY_FILE),'utf8')
const cert = readFileSync(join(__dirname, process.env.CERT_FILE),'utf8')
const httpsServer = https.createServer({key,cert},app)
httpsServer.listen(port,host,()=>{
console.log(`listening on ${protocol}://${host}:${port}`)
});
}else{
app.listen(port);
app.listen(port,host,()=>{
console.log(`listening on ${protocol}://${host}:${port}`)
});
}

0 comments on commit bb135c9

Please sign in to comment.