backend/server.js

24 lines
599 B
JavaScript
Raw Normal View History

2023-09-13 16:20:53 +00:00
const express = require("express");
const app = express();
const cors = require('cors');
const dotenv = require("dotenv").config();
const connectDb = require('./config/dbConnection');
2023-11-22 09:45:06 +00:00
// const fav = require('./routes/favRoute');
2023-09-13 16:20:53 +00:00
app.use(express.json());
app.use(cors());
2023-09-26 17:15:52 +00:00
app.use('/api/users', require('./routes/userRoute'));
2023-09-13 16:20:53 +00:00
2023-11-12 15:17:57 +00:00
app.get('/', function(req, res) {
res.json({
2023-11-12 15:36:33 +00:00
version: "DATE-VERSION"
2023-11-12 15:17:57 +00:00
});
});
2023-09-13 16:20:53 +00:00
2023-11-22 09:45:06 +00:00
app.use('/api/favorites', require('./routes/favRoute'));
2023-11-18 16:59:43 +00:00
2023-09-13 16:20:53 +00:00
app.listen(process.env.PORT, () => {
console.log(`server's running on port ${process.env.PORT}`);
})
connectDb();