backend/server.js

21 lines
No EOL
496 B
JavaScript

const express = require("express");
const app = express();
const cors = require('cors');
const dotenv = require("dotenv").config();
const connectDb = require('./config/dbConnection');
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.listen(process.env.PORT, () => {
console.log(`server's running on port ${process.env.PORT}`);
})
connectDb();