08:30 AM |
Introduction to Node.js |
|
- What is node, where did it come from and why?
- Open a command line, navigate to your project directory and execute
node yourProgramName
- Now lets make a web server in 1 minute.
- Open a browser and navigate to
http://localhost:8080 (or whatever port your node program is listening on)
- ...and exactly why is that earth-shattering?
|
09:00 AM |
Package Management with the Node Package Manager (npm) |
|
- lets get current by asking npm to update itself
npm install npm -g
npm -v
npm init and package.json
npm install something --save (or use package.json as the guide and just say npm install)
npm update something
npm uninstall something
- ...and here is a good SO answer listing ways to find packages
|
09:30 AM |
Node: Beauty in Simplicity |
|
- Let's see and run a simple node web server (
node-examples/simplest-web-server )
- Let's add express and see what we can do with requests
- Primary express features
- A suggested solution directory structure
- Routing
node-examples/example-routes
- Http verb filtering
- URL parameters (this/is/my/pretty/:urlParameter) =>
req.params.urlParameter
- Query string parameters (this/is/my/not/so/pretty?qsParameter=parameterValue) =>
req.query.qsParameter
- POSTed values with body-parser =>
req.body.formFieldName
- Responding to requests
- Static file content
- Digesting form POST values
- Pluggable templating engine for views (Jade, EJS or others)
- Dynamic content
- Including other Js libraries
- ...and now the bad news
- node-style error handling
- The blessing and curse of callbacks (the "pyramid of doom")
|
10:00 AM |
Practice with the basics |
|
- How require() works: exports
- reference with relative path, absolute path or implied search
module.exports = { f1: function() {} } OR
exports.f1 = function() {}
- Reading the documentation for commonly used packages
|
11:30 AM |
Non-relational Concepts and MongoDB |
|
- Relational vs. Non-Relational Design
- Architecture, Scale & Comparison to Relational Approaches
- Collections
- Documents
- Data Types
- CRUD (create, read, update and delete) Operations
- Node + Mongoose + MongoDB = Js Happiness
- Follow these instructions to recreate the Voting Api application used in the jquery session of the class for yourself and to see how it works.
|
Lunch Break (12-1PM)
|
1:00 PM |
Continue building the site & review the concepts |
|
|
2:30 PM |
Build your own api and call it from jquery |
|
- Practice & learn independently
|
4:30 PM |
Deploy your api to a Linux server you launch in one of your cloud accounts |
|
- Deploy and test
- Assign DNS if you like as a subdomain of your existing domain from day 1
|
There are many online tutorials for node. This SO answer has a decent list of recommended sites to visit for more learning.
|