02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist
What is Express Installing & Using Express Demo: Creating a simple REST API Templating Module Overview
02 | What is Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist
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.
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.
02 | Installing and Using Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist
Installing and Using Express npm install express npm install jade
02 | Creating a Simple REST API Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist
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: – To a request handler (callback) app.get('/index', function (req, res) {});
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);
DEMO Creating a simple REST API with Express Framework
DEMO Using the express-generator package.
DEMO Using Express for Multiple Pages with Query Parameters
Building a RESTful API for Dogs ResourceGETPUTPOSTDELETE Collection URI, such as 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 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.
DEMO Using Express to build a RESTful API
Resources Express Framework Intro to Express net net Jade Templates JavaScript and Jade Templating templating
©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.