nationjs: node noob to not so noob
TRANSCRIPT
FROM NOOB TO NOT SO
NOOBO R H O W I ’ M T RY I N G T O G E T G O O D AT N O D E . J S
@reybango
blog.reybango.com
Obligatory Product Placement!!!!
I’m a Node n00b.
<cfset session.authy_id = 0> <!--- Send the Authy request to enable two-factor auth for the user --->
<cfhttp url="https://api.authy.com/protected/json/users/new" method="post"> <cfhttpparam type="formField" name="api_key" value=”application.api_key"> <cfhttpparam type="formField" name="user[email]" value="[email protected]"> <cfhttpparam type="formField" name="user[cellphone]" value='#form.cellphone#'> <cfhttpparam type="formField" name="user[country_code]" value='#form.country#'>
</cfhttp>
<!--- Query param to show the JSON response ---> <cfif isDefined( "url.json" )>
<cfdump var="#cfhttp.filecontent#"> <cfabort>
</cfif>
<!--- Convert the JSON response to a CF struct for easier usage ---> <cfset myJSONStruct = deserializeJSON(cfhttp.filecontent)>
<!--- If you get an Authy ID sent back, all is good and we can test their mobile device ---> <cfif myJSONStruct.user.id>
<cfset session.authy_id = myJSONStruct.user.id> <cflocation url="gettoken.cfm" addtoken="true"> <cfabort>
</cfif>
<cfquery name = "GetCourses" dataSource = "cfdocexamples"> SELECT Dept_ID, CorName, CorLevel FROM courseList ORDER by Dept_ID, CorLevel, CorName
</cfquery>
<p><cfoutput query = "GetCourses" group="CorLevel” GroupCaseSensitive="True">
#Dept_ID# #CorLevel#<br></cfoutput></p>
@joemccann
@joemccann is the David Beckham of Node.js
Bring a voice to the n00bs!
Learning Node.js is hard.
@cmrnh please be my Node.js mentor. You r0x0r!
app.get('/', function(request, response) { response.send( myMessedUpVar ); });
unirest.get('http://www.thinkful.com/').end(function(response) { console.log('Status:', response.statusCode);
console.log('Headers: ', response.headers); console.log('Body:', response.body); });
Node.js the Right Way, Jim R. Wilson & Safari Books Online
<cfoutput>#myMessedUpVar#</cfoutput>
nvm install 4.3.2 --reinstall-packages-from=4.3.1
Nodemon
How do we help the n00bs?
Get yourself a mentor.
Immediately install developer tools.
Obligatory Product Placement!!!!
• nvm – Node Version Manager • VS Code• Node-inspector• Nodemon• Grunt or Gulp CLI
IMMEDIATELY INSTALL DEVELOPER TOOLS
MENTOR-BASED LEARNING
FREE LEARNING
ON-DEMAND LEARNING
• Express • Express-handlebars• Grunt or Gulp• Mocha• Chai• ESLint or JSHint• body-parser
MUST-HAVE STARTER NPM PACKAGES
Start with security best practices.
npm i nsp -g cd your-fantastic-app nsp check
By: Crs9740 https://commons.wikimedia.org/wiki/File:Spartan_Race_-_Muddy_Hit.jpg
Photo Credit: Nuvision Action Image
Photo Credit: Jessica Lipari, USAREUR
Photo Credit: Spartan.com
@reybango