You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
688 B
JavaScript

// Setup the dependencies
const express = require('express');
const mongoose = require('mongoose');
const taskRoute = require("./routes/taskRoute");
// Server setup
const app = express();
const port = 4000;
// Database Connection
mongoose.connect("mongodb+srv://justineyung02:Miras1607@cluster0.mymbzfm.mongodb.net/b320-todo?retryWrites=true&w=majority", {
useNewUrlParser: true,
useUnifiedTopology: true
});
let db = mongoose.connection
db.on('error', console.error.bind(console, 'Connection error'));
db.once('open', () => console.log('Were connected to the cloud database'));
app.use('/tasks', taskRoute);
// server listening
app.listen(port,()=>console.log(`Server running`))