backend/server.js
2023-11-22 16:45:06 +07:00

24 lines
No EOL
599 B
JavaScript

const express = require("express");
const app = express();
const cors = require('cors');
const dotenv = require("dotenv").config();
const connectDb = require('./config/dbConnection');
// const fav = require('./routes/favRoute');
app.use(express.json());
app.use(cors());
app.use('/api/users', require('./routes/userRoute'));
app.get('/', function(req, res) {
res.json({
version: "DATE-VERSION"
});
});
app.use('/api/favorites', require('./routes/favRoute'));
app.listen(process.env.PORT, () => {
console.log(`server's running on port ${process.env.PORT}`);
})
connectDb();