How to run mongodb-rest?

I am new to node, I followed the official manual in the README file , I believe that mongodb-rest was successfully installed, however npm shows:

npm ls /usr/local/bin (empty) 

no here mongodb-rest

I just don’t know how to start the server, as the manual says

  After that you can just issue mongodb-rest on the command line and the server should start. 

I am trying to node mongodb-rest or even type mongodb-rest in the node console, but any of them work. Help!

Update -

Due to the fact that people answered me with a question, I think that I successfully installed the mongodb-rest package via npm and launched the mongodb leisure server like mongodb-rest and made an http request in another terminal window using curl as README writes

 curl -d '{ "A1" : 201 }' -H "Content-Type: application/json" http://localhost:3000/test/example1 

I got curl: (52) Empty reply from server

and a message on the server console:

 node.js:134 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Cannot call method 'authenticate' of null at /usr/local/lib/node_modules/mongodb-rest/lib/rest.js:72:10 at /usr/local/lib/node_modules/mongodb-rest/node_modules/mongodb/lib/mongodb/db.js:176:16 at [object Object].<anonymous> (/usr/local/lib/node_modules/mongodb-rest/node_modules/mongodb/lib/mongodb/connection/server.js:366:7) at [object Object].emit (events.js:81:20) at [object Object].<anonymous> (/usr/local/lib/node_modules/mongodb-rest/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:97:15) at [object Object].emit (events.js:67:17) at Socket.<anonymous> (/usr/local/lib/node_modules/mongodb-rest/node_modules/mongodb/lib/mongodb/connection/connection.js:399:12) at Socket.emit (events.js:64:17) at Array.<anonymous> (net.js:831:12) at EventEmitter._tickCallback (node.js:126:26) 
+4
source share
1 answer

For npm, to install the module worldwide, use the -g option. The readme for mongodb-rest does not indicate this.

 $ [sudo] npm -g install mongodb-rest 

After that, the mongodb-rest command should work.

BTW, to get a list of globally installed modules, add the -g options to the ls command too.

 $ npm -g ls 
+4
source

Source: https://habr.com/ru/post/1391062/


All Articles