h1. Creating Veery API NodeJS Jan 24, 2017 http://veeryapinodejs.soupmode.com hr. edit dns. create cname record: hostname = veeryapinodejs is an alias of = @ cd into /home/veery mkdir Veery-API-NodeJS cd into Veery-API-NodeJS mkdir js cd js mkdir node_modules, although it might get automatically created later create package.json { "name" : "Veery-API-NodeJS", "version" : "1.0.0", "dependencies" : { "express" : "4.14.0", "body-parser" : "1.16.0", "html-entities" : "1.2.0", "querystring" : "0.2.0" } } unsure if i need all of those packages. i looked up the most recent package version numbers at https://www.npmjs.com the command "npm install" will read the package.json file, create node_modules directory, and place the downloaded the packages listed in the json file in that directory. within the same "js" directory, create dispatch.js var express = require('express'), bodyParser = require('body-parser'), path = require('path'), app = express(); app.use(bodyParser.urlencoded({ extended: true })); // parse application/x-www-form-urlencoded app.get('/', function(req, res){ res.send('hello world'); }); app.listen(3002); cd /etc/nginx/sites-available create veeryapinodejs.soupmode.com # veeryapinodejs.soupmode.com-info server { listen 80; server_name veeryapinodejs.soupmode.com; location / { default_type text/html; error_page 404 = @fallback; } location @fallback { proxy_pass http://veeryapinodejs.soupmode.com:3002; } } ln -s /etc/nginx/sites-available/veeryapinodejs.soupmode.com /etc/nginx/sites-enabled/veeryapinodejs.soupmode.com service nginx restart forever start dispatch.js more about forever commands: usage: forever [start | stop | stopall | list] [options] SCRIPT [script options] options: start start SCRIPT as a daemon stop stop the daemon SCRIPT stopall stop all running forever scripts list list all running forever scripts forever list in browser or with curl, access http://veeryapinodejs.soupmode.com should see the plain text response: hello world h3. etc. http://expressjs.com/en/4x/api.html http://jothut.com/cgi-bin/junco.pl/blogpost/36422/10Nov2014/Learning-NodeJS-Programming h3. couchdb clients 1. https://www.npmjs.com/package/couchdb 2. https://www.npmjs.com/package/nano 3. https://www.npmjs.com/package/couchdb-client 4. - the one that i chose to try first: https://www.npmjs.com/package/couchdbjs ### Jan 26, 2017 created command prompt test script. tried running but i received: SyntaxError: Use of const in strict mode. which is due to the use of const in the couchdbjs module and due to my server running and old version of node. http://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version sudo npm cache clean -f sudo npm install -g n sudo n stable sudo ln -sf /usr/local/n/versions/node//bin/node /usr/bin/node version=7.4.0 but when i ran node -v, i was still running the old version instead of v7.4.0 that i installed. the old version was v0.10.21 i tried whereis node which produced: /usr/bin/node /usr/local/bin/node both of those were version 7.4.0. then i did "which node" which produced: /root/local/bin/node i did: ln -sf /usr/local/n/versions/node/7.4.0/bin/node /root/local/bin/node and now when i run "node -v", i get: v7.4.0 and now my test script works.