Skip to content

Commit

Permalink
Merge pull request ookamiiixd#58 from dgbkn/master
Browse files Browse the repository at this point in the history
  • Loading branch information
ookamiiixd authored Jun 21, 2022
2 parents bb7c8ad + b7ba3bb commit 8495fbf
Show file tree
Hide file tree
Showing 3 changed files with 544 additions and 355 deletions.
15 changes: 13 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,30 @@ import express from 'express'
import nodeCleanup from 'node-cleanup'
import routes from './routes.js'
import { init, cleanup } from './whatsapp.js'
import cors from 'cors'

const app = express()
const host = process.env.HOST ?? '127.0.0.1'

const host = process.env.HOST || undefined
const port = parseInt(process.env.PORT ?? 8000)

app.use(cors())
app.use(express.urlencoded({ extended: true }))
app.use(express.json())
app.use('/', routes)

app.listen(port, host, () => {
if(host){
app.listen(port, host, () => {
init()
console.log(`Server is listening on http://${host}:${port}`)
})
}else{
app.listen(port, () => {
init()
console.log(`Server is listening on http://localhost:${port}`)
})
}


nodeCleanup(cleanup)

Expand Down
Loading

0 comments on commit 8495fbf

Please sign in to comment.