Presentation is loading. Please wait.

Presentation is loading. Please wait.

02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.

Similar presentations


Presentation on theme: "02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist."— Presentation transcript:

1 02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist

2 What is Express Installing & Using Express Demo: Creating a simple REST API Templating Module Overview

3 02 | What is Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist

4 What is Express? Express is a minimal, open source and flexible node.js web app framework designed to make developing websites, web apps and APIs much easier.

5 Why use Express? Express helps you respond to requests with route support so that you may write responses to specific URLs. Supports multiple templating engines to simplify generating HTML.

6 02 | Installing and Using Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist

7 Installing and Using Express npm install express npm install jade

8 02 | Creating a Simple REST API Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist

9 Explanation of Routes A router maps HTTP requests to a callback. HTTP requests can be sent as GET/POST/PUT/DELETE, etc. URLs describe the location targeted. Node helps you map a HTTP GET request like: –http://localhost:8888/index To a request handler (callback) app.get('/index', function (req, res) {});

10 Creating a Simple Express Application var express = require('express'); var app = express(); app.get('/', function (req, res) { res.json({message:'hooray! welcome to our api! '}); }); app.listen(process.env.PORT || 8080);

11 DEMO Creating a simple REST API with Express Framework

12 DEMO Using the express-generator package.

13 DEMO Using Express for Multiple Pages with Query Parameters

14 Building a RESTful API for Dogs ResourceGETPUTPOSTDELETE Collection URI, such as http://api.e xample.com /v1/dogs/ List all the dogs Replace all the dogs with a new collection of dogs. Create a new dog in the collection. Delete the entire dog collection. Element URI, such as http://api.e xample.com /v1/dog/1 Get a specific dog. Replace a dog in the collection with another dog. Not used. Delete the dog from the collection.

15 DEMO Using Express to build a RESTful API

16 Resources Express Framework http://expressjs.com/http://expressjs.com/ Intro to Express http://code.tutsplus.com/tutorials/introduction-to-express-- net-33367 http://code.tutsplus.com/tutorials/introduction-to-express-- net-33367 Jade Templates http://jade-lang.com/tutorial/http://jade-lang.com/tutorial/ JavaScript and Jade Templating http://www.slideshare.net/wearefractal/jade-javascript- templating

17 ©2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist."

Similar presentations


Ads by Google