const express = require('express'); const mongoose = require('mongoose'); const userRoutes = require('./routes/userRoutes'); require('dotenv').config(); const app = express(); app.use(express.json()); mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true, useUnifiedTopology: true }).then(() => console.log("MongoDB connected")); app.use('/api', userRoutes); app.listen(5000, () => console.log('MongoDB Auth server running at http://localhost:5000'));
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter