23 lines
629 B
JavaScript
23 lines
629 B
JavaScript
import express from 'express';
|
|
import cors from 'cors';
|
|
import dotenv from 'dotenv';
|
|
import { testConnection } from "./database/db.js";
|
|
import router from "./routes/index.js";
|
|
import cookieParser from 'cookie-parser';
|
|
|
|
dotenv.config();
|
|
const app = express();
|
|
|
|
app.use(cors());
|
|
app.use(cookieParser());
|
|
app.use(express.json());
|
|
app.use(express.urlencoded({ extended: true }));
|
|
app.use(router);
|
|
|
|
// Serve static files from the uploads directory
|
|
app.use(express.static('public'));
|
|
|
|
app.listen(process.env.APP_PORT, () => {
|
|
testConnection();
|
|
console.log(`Server running on port http://localhost:${process.env.APP_PORT}`);
|
|
}) |