Wiki

Clone wiki

nodejs / contribute

Summary

Want to contribute an example? This page describes how. Note you need a bitbucket profile to contribute. Don't worry, they're free :-) If any of these steps are unclear then please log an issue to ask for clarification.

New to Git? Check out this tutorial.

Step 1 - Fork The Repo

Go here to fork the repo and follow the below screenshots.

tut1_1_fork.png

tut1_2_fork.png

Step 2 - Clone The Repo

Now you have a copy of the repo under your personal profile, as shown in below screenshot. Also notice the custom URL on the right side. Copy that for the next step.

tut1_3_clone1.png

Next go the shell on IBM i and do $ git clone git@bitbucket.org:aaronbartell/nodejs.git, as shown below.

NOTE: You need to generate and copy your public ssh key to bitbucket first.

tut1_4_clone2.png

At this point a copy of the Git repo is on your IBM i.

Step 3 - Make Changes (local, on your IBM i)

Below is a new IFS file I added, /home/aaron/git/nodejs/examples/db2_simple.js. See Environment Setup for editor options.

#!nodejs

//
// Show how to connect to DB2 for i from Node.js
//

var http = require('http')
var db = require('/QOpenSys/QIBM/ProdData/Node/os400/db2i/lib/db2')

var server = http.createServer(function (req, res) {
  db.init()
  db.conn("*LOCAL")
  db.exec("SELECT LSTNAM, STATE FROM QIWS.QCUSTCDT", function(rs) {
    res.writeHead(200, {'Content-Type': 'text/plain'})
    res.end(JSON.stringify(rs))
  })
  db.close()
})

server.listen(8002)
var host = server.address().address
var port = server.address().port
console.log('Example app listening at http://%s:%s', host, port)

Step 4 - Add, Commit, Push

Assuming you've tested to make sure you change works <cough>, the last step is to get it back on the Git server.

tut1_5_commit.png

Step 5 - Pull Request

At this point the changes are still in your personal bitbucket account and you need to issue a pull request to the parent repo. This will notify the parent repo that you would like to add content and they will have the option to accept or deny the pull request.

tut1_6_pull.png

tut1_7_pull2.png

Updated