meetup js 122615
TRANSCRIPT
Node school
12/26/2015 1parish.saintpats.org kofc809.org
Full-stack javascript development
Today’s Event hosts
• St. Patrick’s Church & School - Tacoma
• Knights of Columbus Tacoma Council 809
12/26/2015 2parish.saintpats.org kofc809.org
Full-stack javascript development
Moderator: Joe Devlin
12/26/2015 3parish.saintpats.org kofc809.org
Full-stack javascript development
Access this slideshow at:
http://vividventures.biz/d/?q=javascript
12/26/2015 4parish.saintpats.org kofc809.org
A word from our hosts•St. Patrick’s Church – Tacoma
o The pastoral council has generously offered us this location for today, as part of the churches community outreach.
o Founded in 1892
o Aligned with St. Patrick’s Catholic School link
o Reference: The Bible API
o Working on the Engaged Church model“Growing an Engaged Church” by Albert Winseman, Gallup Press, ISBN 978-1-59562-014-9
o Promoting personal development with Strengths Finder.“Strengths Finder” by Tom Rath, Gallup Press, ISBN 978-1-59562-015-6
strengthsfinder.com
12/26/2015 5parish.saintpats.org kofc809.org
A word from our hosts• Knights of Columbus www.kofc.org
o Founded in 1882
o Dedicated to “Saving Lives and Changing Lives”
o Promoting strong families through charitable giving and a AAA rated life insurance and annuity program.
o Local projectsHabitat for Humanity Build, Blood Drive, Ultrasound for pregnancy care &
4US.org, Coats for Kids, Wheelchair Mission.
12/26/2015 6parish.saintpats.org kofc809.org
Introduction•Joe Devlin - moderator
o Member of St Patrick’s Parish and K of C council 809
o Working as a web host for small to medium sized businesses.
o Interested in Javascript for the obvious reasons that it is a must
for web development, plus for the purposes of getting people
together to code; JS is a universal standard that comes with
freely downloadable browsers and tools. We can easily
collaborate.
12/26/2015 7parish.saintpats.org kofc809.org
Time management
12/26/2015 8parish.saintpats.org kofc809.org
Present
Code
Discuss
Rest Rooms• Down the hall past the fireside room
12/26/2015 9parish.saintpats.org kofc809.org
Upcoming events
12/26/2015 10parish.saintpats.org kofc809.org
• 23-Jan Weather-app mini sprint
• 21-May Nodeschool International Day
Attendee Introduction• Let each of us introduce ourselves
o My name is ____________. (First name)
o Working as a ____________, or looking for work as a _________.
o I have been working on / studying ____________________.
12/26/2015 11parish.saintpats.org kofc809.org
Today’s code resource
By: Randy Kamradt Sr.https://rlkamradt.wordpress.com/
https://github.com/Tacoma-JS/javamanForked from https://github.com/rkamradt/javaman
12/26/2015 12parish.saintpats.org kofc809.org
Prerequisites
• Nodejs installed on your laptop https://nodejs.org/en/download/
o check to see if it is installed with a terminal on the comand line $ node -v
• Create a working directory and change into it o $ mkdir node_workspaces && cd node_workspaces
• Clone the project into the workspaceo $ git clone https://github.com/Tacoma-JS/javaman.git
12/26/2015 13parish.saintpats.org kofc809.org
Where to start inspecting the app?
• The README.md of course!
• package.jsono to manage locally installed npm packages
o Seehttps://github.com/Tacoma-JS/javaman/blob/master/package.json
Or $ cd javaman
$ cat package.json | more (or some other text editor)
Reference: https://docs.npmjs.com/getting-started/using-a-package.json
12/26/2015 14parish.saintpats.org kofc809.org
Packages
• npm - node package manager is installed with nodejs
• Confirm installation with o $ npm -v
• Update the npm installation as linux root or as windows administrator
o (might cause npm to not function at all… ie deleted) o $ sudo su
o $ npm update npm -g
OR tryo $ npm update npm
• Reference:
• https://www.npmjs.com/
12/26/2015 15parish.saintpats.org kofc809.org
Packages• Following the README.md instructions in
javaman we see that $ grunt build will be required to update the project files.
• Install the grunt command line interface globally as super user or administrator
o $ sudo su
o Password:---------
o npm install -g grunt-cli
• Reference:o http://gruntjs.com/getting-started
12/26/2015 16parish.saintpats.org kofc809.org
Packages• If you have a package.json file in your
directory and you run
$npm install
then npm will look at the dependencies that are listed in that file and download the latest versions satisfying semver rules for all of those.
• $ grunt build
• $ grunt test ( to see test results again)
12/26/2015 17parish.saintpats.org kofc809.org
Codeship.com• What commands are in the codeship test?
o The same commands that we just ran...
$ nvm install 0.10 (extra)$ npm install -g grunt-cli
$ npm install
$ grunt build
plus$ npm test
$ grunt test
Reference:https://codeship.com/features
12/26/2015 18parish.saintpats.org kofc809.org
Some of the Packages in javaman package.json
12/26/2015 19parish.saintpats.org kofc809.org
body-parser
grunt-cli express-session
Client side packagesServer side packages
Tools
load-grunt-tasks
build debuggingmethod-override
morgan
Test
?
Should JS• By inspecting the package list we see the BDD tests are
written with ShouldJS.• What tests are run? Try it and see from command
line…$ grunt test
• AND notice the mention of simple-mocha in the test results, and grunt-simple-mocha in package.json.
Reference:Should.js - https://www.npmjs.com/package/shouldStack Overflow - http://stackoverflow.com/tags/should.js/hot
In your browser CDNjs - https://cdnjs.com/libraries/should.js- https://cdnjs.com/libraries/mocha
Mochajs - https://mochajs.org/
12/26/2015 20parish.saintpats.org kofc809.org
Mochajs and shouldjs combined• What parts of the tests are mochajs?
o describe()
o it()
• What parts of the tests are shouldjs?o state.users.should.be.instanceOf(Array);
o state.users.should.have.length(1);
Reference:Javaman - https://github.com/Tacoma-JS/javaman/blob/master/test/server/field.test.js
Should.js - https://www.npmjs.com/package/shouldMochajs - https://mochajs.org/
12/26/2015 21parish.saintpats.org kofc809.org
Express – web framework• server.js is in the top level directory of
javaman
Reference:Javaman – https://github.com/Tacoma-JS/javaman/blob/master/server.js
Teamtreehouse tutorial? - express-basics
o your-first-express-app
12/26/2015 22parish.saintpats.org kofc809.org
Other tutorials
Reference:TDD tutorial – http://www.slideshare.net/conancat/nodejs-writing-tests-a-
beginners-guide/23-4_Test_Situations_that_well
12/26/2015 23parish.saintpats.org kofc809.org