kickstarter your node.js application

Post on 12-Jul-2015

952 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Node MeetupTuesday, December 2, 2014

$ whoiam

{ name : “Hengki Sihombing” email : “hengki.sihombing@gmail.com”, twitter : “hengkiardo”, github : “aredo” }

module.export =

Kickstarter Your Node.JS Application

http://blog.efvincent.com/wp-content/uploads/2011/06/Capture.png

require(‘express’) require(‘mongoose’) require(‘passport’) require(‘async’) require(‘grunt’) require(‘demo’) require(‘QA’)

Why Node.JS

Answer by your selfWhy you come to this meetup :)

Express.JSFast, unopinionated, minimalist web framework for Node.js

expressjs.com

$ npm install express

MVC Framework base on Express.JS

http://www.quora.com/Why-should-I-use-Express-when-developing-a-web-app-with-Node-js http://evanhahn.com/understanding-express/

• KrakenJs http://locomotivejs.org/ • Locomotive.JS http://locomotivejs.org/

• Sails http://locomotivejs.org/ • Sleek.JS http://sleekjs.com/ • ……

Why Express.JS ???

http://www.quora.com/Why-should-I-use-Express-when-developing-a-web-app-with-Node-js http://evanhahn.com/understanding-express/

• Express is a lightweight framework, meaning it does not make too many assumptions but gives you enough to avoid re-inventing the wheel.

• Express is preferred because it adds dead simple routing and support for Connect middleware, allowing many extensions and useful features

• Like any abstraction, Express hides difficult bits and says "don't worry, you don't need to understand this part". It does things for you so that you don't have to bother. In other words, it's magic

• https://www.google.com/#q=why+express.js

Simple Express App

Why Mongoose ?

• Because it provides easy-to-use methods for interacting with MongoDB. It is ORM, actually. It helps you forget about driver's query documentation, and focus on your models.

• Mongoose provides a straight-forward, schema-based solution to modeling your application data and includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

• Mongoose provides various functionalities which makes your life easy such as

MongoDB Connection with Mongoose

• 140+ authentication strategies • Easily handle success and failure • Supports persistent sessions • Dynamic scope and permissions • Pick and choose required strategies • Implement custom strategies • Lightweight code base

•Easy To Use!!

https://github.com/jaredhanson/passport

Sample Twitter Auth with Passport

Sample FB Auth with Passport

Sample Linkedin Auth with Passport

ASYNCHRONOUSBecause Javascript

PromisesPromises… Promises… Never break your promises.

Personally, never make promises.

https://blog.domenic.me/youre-missing-the-point-of-promises

😟

Not part of the Node“until latest stable version”

Makes in tegrat ion more d i f f icu l t . Makes swapping code in / out more painfu l .

So good i t ’s got i t ’s own websi te cal lbackhel l .com

Callbacks

async

$ npm install async — save

Async is a utility module which provides straight-forward, powerful functions for working with

asynchronous JavaScript. Although originally designed for use with Node.js, it can also be

used directly in the browser.

https://github.com/caolan/async

Why use a task runner or

build system?

another build tools: Gulp, Make, NPM, Ant, Maven

Automation

Automation isn’t about being lazy.

It’s about being efficient

$ npm install -g grunt-cli

Before you get started

$ npm install —save-dev grunt

package.json to manage dependencies

Grunt Overview

Demo

https://express4-bootstrap-starter.herokuapp.com/

https://github.com/aredo/express4-bootstrap-starter

$ git clone git@github.com:aredo/express4-bootstrap-starter.git

QA!

{ name : “Hengki Sihombing” email : “hengki.sihombing@gmail.com”, twitter : “hengkiardo”, github : “aredo” }

module.export =

top related