I have this as a server.js:
var express = require('express'),
app = express(),
port = process.env.PORT || 3000,
mongoose = require('mongoose'),
Task = require('./api/models/toDoListModel'),
bodyParser = require('body-parser');
mongoose.Promise = global.Promise;
mongoose.createConnection('mongodb://localhost:27017/Tododb');
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
var routes = require('./api/routes/toDoListRoutes');
routes(app);
app.listen(port);
And when I use posman to post/get, I get no response from the server (on a correct key-value) although localhost:27017 is running and I created a Tododb db using Robo 3T. But when I don't enter any key/value in postman, I get a response. Am I missing something? All addresses are correct.
.createConnection()does not actually "connect". You need to initiate the connection. See Connections in the documentation