working on healthcheck api and auth api
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
const express = require('express')
|
||||
const path = require('path')
|
||||
|
||||
const authRoutes = require('./routes/auth')
|
||||
const productsRoutes = require('./routes/products')
|
||||
const usersRoutes = require('./routes/users')
|
||||
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
|
||||
@@ -11,14 +10,11 @@ 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
|
||||
|
||||
// Static Files (Serving Frontend)
|
||||
app.use(express.static(path.join(__dirname, 'public')))
|
||||
app.use(cors())
|
||||
|
||||
// Mount Routes
|
||||
app.use('/healthcheck', healthCheckRoutes)
|
||||
app.use('/auth', authRoutes)
|
||||
app.use('/products', productsRoutes)
|
||||
app.use('/users', usersRoutes)
|
||||
|
||||
// Default Route (Catch-all for undefined routes)
|
||||
app.use((req, res, next) => {
|
||||
|
||||
Reference in New Issue
Block a user