Skip to content

Commit

Permalink
Fix server script
Browse files Browse the repository at this point in the history
  • Loading branch information
devnoot committed May 17, 2024
1 parent d8d5c36 commit 23e9a58
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions server/server.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import express from 'express'
import { createProxyMiddleware } from 'http-proxy-middleware'
import requestId from 'express-request-id'
import morgan from 'morgan'
import { resolve } from 'path'

const app = express()

app.use(requestId)

morgan.token('id', req => {
req.id.split('-')[0]
})

app.use(
morgan(
"[:date[iso] #:id] Started :method :url for :remote-addr",
{
immediate: true
}
)
)
app.use(morgan('common'))

const apiProxy = createProxyMiddleware({
target: 'https://doomworld.com/idgames/api/api.php',
Expand All @@ -30,10 +17,10 @@ const apiProxy = createProxyMiddleware({

app.use('/api', apiProxy)

app.use(express.static('dist'))
app.use(express.static('./dist'))

const PORT = process.env.PORT || 8080
const PORT = process.env.PORT || 3000

app.listen(PORT, () => {
console.log(`Proxy server is running on port ${PORT}`)
console.log(`Server is running on port ${PORT}`)
})

0 comments on commit 23e9a58

Please sign in to comment.