Express js not running


#1

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 ?


#2

It is. Steps to make it run:

  • git clone git@github.com:srconline/expresscruddemo.git
  • cd expresscruddemo
  • npm i
  • start MongoDB (e.g. by running the command mongod)
  • npm run start
  • visit http://localhost:8000/

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 });

#3

Thanks. This works


#4

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


#5

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