Express js not running

git hub url : https://github.com/srconline/expresscruddemo

from project directory in terminal

I tried this npm start
05-express-first-app@0.0.0 start F:\expressdemo\expresscruddemo> node ./bin/www

(node:7884) DeprecationWarning: open() is deprecated in mongoose >= 4.11.0, use openUri() instead, or set the useMongoClient option if using connect() or createConnection(). See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client

I tried this also…

node app.js
(node:8492) DeprecationWarning: open() is deprecated in mongoose >= 4.11.0, use openUri() instead, or set the useMongoClient option if using connect() or createConnection(). See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client

app is not running . I can not open the home page.

Where it is stuck ?

It is. Steps to make it run:

What your seeing on the command line is a deprecation warning. This should be fixed, but it won’t stop the app from running.

To fix the warning, change line 4 in index.js from:

mongoose.connect('localhost:27017/test');

to:

mongoose.connect('mongodb://localhost:27017/test', { useMongoClient: true });
1 Like

Thanks. This works

No worries. You can see that the server is running on port 8000 in bin/www on line 15.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.