working on healthcheck api and auth api (#2)
Reviewed-on: #2 Co-authored-by: Joseph Nelson <joseph.nelson4456@gmail.com> Co-committed-by: Joseph Nelson <joseph.nelson4456@gmail.com>
This commit was merged in pull request #2.
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
import express from 'express'
|
||||
import path from 'path'
|
||||
import cors from 'cors'
|
||||
import healthCheckRoutes from './routes/healthcheck'
|
||||
import authRoutes from './routes/auth'
|
||||
|
||||
const app = express()
|
||||
const port = process.env.PORT || 3000
|
||||
|
||||
// Middleware
|
||||
app.use(express.json()) // For parsing application/json
|
||||
app.use(express.urlencoded({ extended: true })) // For parsing URL-encoded form data
|
||||
app.use(cors())
|
||||
|
||||
// Mount Routes
|
||||
app.use('/healthcheck', healthCheckRoutes)
|
||||
app.use('/auth', authRoutes)
|
||||
|
||||
// Default Route (Catch-all for undefined routes)
|
||||
app.use((req, res, next) => {
|
||||
res.status(404).send('Sorry, the resource you requested could not be found.')
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Server listening on port ${port}`)
|
||||
})
|
||||
|
||||
export default app
|
||||
Reference in New Issue
Block a user