RESTful Web Development With Nodejs and Express. REST Stands for REpresentational State Transfer Has the following constraints: ◦Client-Server ◦Stateless.

Slides:



Advertisements
Similar presentations
Give it a REST already Arnon Rotem-Gal-Oz VP R&D xsights
Advertisements

REST Vs. SOAP.
REST Introduction 吴海生 博克软件(杭州)有限公司.
Introduction to Web Services
© 2014 IBM Corporation Empowering the IBM ecosystem Introduction to Developing applications using node.js on Bluemix IBM Ecosystem Development Instructors.
ECE 4450:427/527 - Computer Networks Spring 2015 Dr. Nghi Tran Department of Electrical & Computer Engineering Lecture 8: Application Layer Dr. Nghi Tran.
.NET Framework V3.5+ & RESTful web services Mike Taulty Developer & Platform Group Microsoft Ltd
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
FORESEC Academy FORESEC Academy Security Essentials (II)
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
MEAN Stack c0nrad. Overview Day 1: – MEAN Stack – NodeJS Mini Cat Fact Spammer – MongoDB Cat Profiles – Express Catbook API (Facebook for cats) Day 2:
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Wyatt Pearsall November  HyperText Transfer Protocol.
RESTful applications Norman White. REST Representational state transfer Key concepts – Client Server architecture built on transferring resources between.
Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin.
Python and REST Kevin Hibma. What is REST? Why REST? REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) It relies on a.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
Introduction to ASP.NET1. 2 Web applications in general Web applications are divided into two parts –The server part –The client part The server part.
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
Introduction to the SharePoint 2013 REST API. 2 About Me SharePoint Solutions Architect at Sparkhound in Baton Rouge
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
DM_PPT_NP_v01 SESIP_0715_JR HDF Server HDF for the Web John Readey The HDF Group Champaign Illinois USA.
Web Architecture update for WSAWG/WSDL TAG published Principles of the Web Contents: –Identifiers Most of the work –Formats Not much –Protocols Summary.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
RESTful Web Services What is RESTful?
02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
02 | Introduction to Express Framework Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
Web Technologies Lecture 11 Implementing RESTful services.
Web Technologies Lecture 6 State preservation. Motivation How to keep user data while navigating on a website? – Authenticate only once – Store wish list.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
Display Page (HTML/CSS)
Node.JS introduction. What is Node.JS? v8 JavaScript runtime Event driven Non-blocking standard libraries Most APIs speak streams Provides a package manager.
Feeling RESTful? Well, first we’ll define a Web Service –A web page meant to be consumed by a computer via an autonomous program as opposed to a web browser.
Martin Kruliš by Martin Kruliš (v1.0)1.
NCCUCS 軟體工程概論 Lecture 5: Ajax, Mashups April 29, 2014.
Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015.
4.3. Code animations by using JavaScript Access data access by using JavaScript. Creating Animations, Working with Graphics, and Accessing Data.
National College of Science & Information Technology.
Web Development. Agenda Web History Network Architecture Types of Server The languages of the web Protocols API 2.
RESTful Sevices Distributed Objects Presented by: Shivank Malik
Node.js Express Web Applications
REST- Representational State Transfer Enn Õunapuu
Node.js Express Web Services
AJAX and REST.
CMPE 280 Web UI Design and Development October 26 Class Meeting
What is REST API ? A REST (Representational State Transfer) Server simply provides access to resources and the REST client accesses and presents the.
CMPE 280 Web UI Design and Development October 24 Class Meeting
Build Better Apps with MEAN.
WEB API.
Abel Sanchez, John R. Williams
JavaScript & jQuery AJAX.
REST APIs Maxwell Furman Department of MIS Fox School of Business
Lecture 17: Web Service and post
Lecture 16: Writing Your Own Web Service
CSc 337 Lecture 27: Cookies.
RESTful Web Services.
Web API with Angular 2 Front End
CSc 337 Lecture 1: post.
Python and REST Kevin Hibma.
Lecture 14: JSON and Web SERVICES
DR. JOHN ABRAHAM PROFESSOR UTPA
Week 05 Node.js Week 05
A gentle introduction to RESTful APIs
CSc 337 Lecture 18: post.
.NET Framework V3.5+ & RESTful web services
Chengyu Sun California State University, Los Angeles
Lecture 15: Writing Your Own Web Service
CSc 337 Lecture 25: Cookies.
Presentation transcript:

RESTful Web Development With Nodejs and Express

REST Stands for REpresentational State Transfer Has the following constraints: ◦Client-Server ◦Stateless ◦Cacheable ◦Layered System ◦Code on Demand ◦Uniform Interface

REST on the web Every kind of resource you want is at a different URI Interact with resources using the HTTP verbs ◦PUT (Create) ◦GET (Read) ◦POST (Update) ◦DELETE (Delete) The server does not keep track of state (except for authentication) The client manages the logic of the application.

REST Examples Assume we are making an app to track what people we meet with ◦We need the following resources: ◦Users ◦Meetings ◦We might use the following URIs ◦GET /user(list all users) ◦POST/user/1(get information about user with ID 1) ◦PUT /meeting(create a new meeting) ◦DELETE /meeting /5(delete meeting with ID 5) ◦The responses are usually JSON, e.g. { 'id': 1, 'name': 'John MacDonald', 'hometown': 'Halifax', 'occupation': 'Farmer' }

Using NodeJS NodeJS is just a JavaScript interpreter. It comes with a package manager called npm ◦Install packages like this: npm install ◦This will install it in the current folder. ◦To install globally, do npm install –g To use Node as a webserver, you must write an application that responds to web requests. Node has a library (HTTP) for doing this, but it’s easier to use a framework, like Express To access a library, use the require() function

Using Express Express is just a package for Node ◦Create a new web application with var app = express(); ◦Respond to requests like app.get('/user', function(req, res){ ◦Look at parameters through the req object ◦ req.params for query parameters ◦ req.body for post fields ◦ req.files for files ◦Send responses through the res object ◦ res.send("Hi mom!") ◦Start the application with ◦ app.listen( )

Client-Server Communication On the client side, use XMLHttpRequest (or jQuery) If you are not getting your data from the same place as your page, then you will have to use Cross Origin Resource Sharing (CORS) var xhr = new XMLHttpRequest(); //Might also use onreadystatechange xhr.onload = function() { var responseObject = JSON.parse(this.responseText); }; xhr.open('get', 'user'); xhr.send();