Routes Carol Wolf Computer Science. RESTful Architecture  Rails uses REST-style architecture: representation state transfer  resources :courses in routes.rb.

Slides:



Advertisements
Similar presentations
Publication Module using back end interface. Institution Data Entry Add Documents. Edit/Delete Documents that are added but not yet sent to Institution.
Advertisements

Reinventing using REST. Anything addressable by a URI is called a resource GET, PUT, POST, DELETE WebDAV (MOVE, LOCK)
Australian Curriculum + Online Planning Tool.
A Short Course on How to Manage SLOs with TracDat.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
How to Upload and Submit a Document to Your Tk20 Portfolio Use this when your instructor has asked you to put something in your Tk20 Portfolio (as opposed.
BlackBoard Online Submission Annual Assessment Updates
HTTP By: Becky Fultz, Joe Flager, Katie Huston, Tom Packard, Allison Wilsey.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Server-side Scripting Powering the webs favourite services.
Web application architecture
Views Carol Wolf Computer Science. Extended Ruby  Views files are written in extended Ruby, erb.  They end in.html.erb.  Ruby code is intermixed with.
CSCI 6962: Server-side Design and Programming Web Services.
Bloomfield School District TECH TUESDAY WORKSHOP Technology Services and Support Edline/EGP-Grading Online January 10, 2012 Joanne Decker.
Forms Carol Wolf Computer Science. The Controller  To create a controller, type  rails generate controller pizza index order  This creates a controller.
1 Dr Alexiei Dingli Web Science Stream Introducing Rails.
CSCI 6962: Server-side Design and Programming Introduction to Active Server Pages.
Ruby on Rails CSE 190M, Spring 2009 Week 6. Overview How to use a database Demo creating a blog application on Rails Explain how the application works.
System Initialization 1)User starts application. 2)Client loads settings. 3)Client loads contact address book. 4)Client displays contact list. 5)Client.
OCBSA.ORG WEBSITE INTRODUCTION Mark Pugh. We all learn from each other! Mark Pugh.
Saving Work to Your School Server Click through this presentation at your own speed. Use it as a review or a guide while saving a project.
2007cs Servers on the Web. The World-Wide Web 2007 cs CSS JS HTML Server Browser JS CSS HTML Transfer of resources using HTTP.
Web Design Part I. Click Menu Site to create a new site root.
The Module Road Map Assignment 1 Road Map We will look at… Internet / World Wide Web Aspects of their operation The role of clients and servers ASPX.
Create, Update and Delete Carol Wolf Computer Science.
Enter the URL Enter the URL. 2. Enter the Password 1. Enter the login ID 3. Click on submit button 3. Click on submit button.
Ruby on Rails Controller of MVC. Routes How we map URIs like /tweets/1 to calling the show method of the Controller.
Rails and routing INFO 2310: Topics in Web Design and Programming.
The Controller Carol Wolf Computer Science. Rails generate commands  Using the generate command, you can create a number of useful objects.  Rails:
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Option Sheets Presentation Course Selection. Input your course selections online Using any computer and internet browser go to: student.hwdsb.on.ca Click.
Distributed Storage Middleware To build a distributed web storage service for small files; To provides RESTFUL interface to access files and directories.
Generating XML Data from a Database Eugenia Fernandez IUPUI.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
Schedule Vacations Overview Click your mouse to continue! Copyright 2004 Schedule Tech. All Rights Reserved.
MVC Controllers TestsMigrations Ye Olde Internet Model DB Server Router View Browser Today’s focus Controller.
REST URI Merli Lall.
An introduction to REST for SharePoint 2013
Mail Merge.
CMPE 280 Web UI Design and Development October 24 Class Meeting
How to post a discussion through Moodle Room: Your course website home view Click on a Discussion.
PHP / MySQL Introduction
Testing REST IPA using POSTMAN
Marking a Piece of Equipment for Transfer/Scrap/Withdrawal
File service architecture
Canceling an Existing Requisition
OCBSA.ORG WEBSITE INTRODUCTION Mark Pugh.
Model – View – Controller Pattern
Video list editor BIS1523 – Lecture 24.
$, $$, $$$ API testing Edition
how to Multi-create booking requests? Upload from excel
WebDAV Design Overview
Request Form You gain access to the Request Form from your intranet set-up by your IT dept. Or the internet via either our desktop launcher icon. Or a.
DATA EXCHANGE.
REST APIs Maxwell Furman Department of MIS Fox School of Business
Working With Progress Reports
Web API with Angular 2 Front End
MVC Controllers.
Option Sheets Presentation
MVC Controllers.
Engrade Discussions.
Web APIs In computer programming, an application programming interface (API) is a set of subroutine definitions, protocols, and tools for building application.
Week 05 Node.js Week 05
MVC Controllers.
Client-Server Model: Requesting a Web Page
How to Use templates?.
Asp.Net MVC Conventions
Chengyu Sun California State University, Los Angeles
Presentation transcript:

Routes Carol Wolf Computer Science

RESTful Architecture  Rails uses REST-style architecture: representation state transfer  resources :courses in routes.rb translates to: courses GET /courses(.:format) {:action=>"index", :controller=>"courses"} POST /courses(.:format) {:action=>"create", :controller=>"courses"} new_course GET /courses/new(.:format) {:action=>"new", :controller=>"courses"} edit_course GET /courses/:id/edit(.:format) {:action=>"edit", :controller=>"courses"} course GET /courses/:id(.:format) {:action=>"show", :controller=>"courses"} PUT /courses/:id(.:format) {:action=>"update", :controller=>"courses"} DELETE /courses/:id(.:format) {:action=>"destroy", :controller=>"courses"}

RESTful Architecture – from the textbook  index  Returns a list of the resources.  create  Creates a new resource from the data in the POST request, adding it to the collection.  new  Constructs a new resource and passes it to the client. This resource will not have been saved on the server. You can think of the new action as creating an empty form for the client to fill in.  show  Returns the contents of the resource identified by params[:id].  update  Updates the contents of the resource identified by params[:id] with the data associated with the request.  edit  Returns the contents of the resource identified by params[:id] in a form suitable for editing.  destroy  Destroys the resource identified by params[:id].

Generating a controller  Generating a controller creates routes (with gets) for each of the methods in the controller. rails generate controller librarian index list_books find_book  This produces a controller with three methods and adds three routes to the routes.rb file.  Two of the routes must be changed to posts.  get "librarian/index "  post "librarian/list_books "  post "librarian/find_book"  If a view is sent with a submit button, its route must be a post.