Javatpoint Logo
Javatpoint Logo

Connect Node.js with CouchDB

Go to C folder. Create a folder name "couchemployees" within an already created folder "projects".

Open command prompt and go to the location.

CouchDB Connect nodejs 1
CouchDB Connect nodejs 2

Create a file as "app.js", having the following code:

Now entry point will be app.json

CouchDB Connect nodejs 3
CouchDB Connect nodejs 4

Now use the following command:

npm install express body-parser ejs node-couchdb --save

CouchDB Connect nodejs 5
CouchDB Connect nodejs 6

Execute the following code to start local server :

CouchDB Connect nodejs 7

Now server is started:

Open the local browser: localhost:3000

CouchDB Connect nodejs 8

List Databases

Edit the app.js file with the following code:

CouchDB Connect nodejs 9

Create a folder "view" and then create a file "index.ejs" within it, having the following code:

Now change in the "app.js" file:

CouchDB Connect nodejs 10
CouchDB Connect nodejs 11




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA