Suche senden
Hochladen
Getting Rest With Webmachine
•
19 gefällt mir
•
5,725 views
K
kevsmith
Folgen
Learn how to use webmachine to build a RESTful web application in Erlang.
Weniger lesen
Mehr lesen
Technologie
News & Politik
Melden
Teilen
Melden
Teilen
1 von 51
Empfohlen
groovy & grails - lecture 3
groovy & grails - lecture 3
Alexandre Masselot
Php variables (english)
Php variables (english)
Mahmoud Masih Tehrani
Introduction to PHP
Introduction to PHP
prabhatjon
Unfiltered Unveiled
Unfiltered Unveiled
Wilfred Springer
PHP for Grown-ups
PHP for Grown-ups
Manuel Lemos
Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
Mozammel Haque
Data Types In PHP
Data Types In PHP
Mark Niebergall
2014 database - course 2 - php
2014 database - course 2 - php
Hung-yu Lin
Empfohlen
groovy & grails - lecture 3
groovy & grails - lecture 3
Alexandre Masselot
Php variables (english)
Php variables (english)
Mahmoud Masih Tehrani
Introduction to PHP
Introduction to PHP
prabhatjon
Unfiltered Unveiled
Unfiltered Unveiled
Wilfred Springer
PHP for Grown-ups
PHP for Grown-ups
Manuel Lemos
Beginning web programming with PHP [PHP 101-02]
Beginning web programming with PHP [PHP 101-02]
Mozammel Haque
Data Types In PHP
Data Types In PHP
Mark Niebergall
2014 database - course 2 - php
2014 database - course 2 - php
Hung-yu Lin
Php Lecture Notes
Php Lecture Notes
Santhiya Grace
PHP variables
PHP variables
Siddique Ibrahim
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
Ismail Mukiibi
Php mysql
Php mysql
Alebachew Zewdu
Class 2 - Introduction to PHP
Class 2 - Introduction to PHP
Ahmed Swilam
My cool new Slideshow!
My cool new Slideshow!
omprakash_bagrao_prdxn
slidesharenew1
slidesharenew1
truptitasol
Opa hackathon
Opa hackathon
Henri Binsztok
Intermediate PHP
Intermediate PHP
Bradley Holt
Web 9 | OOP in PHP
Web 9 | OOP in PHP
Mohammad Imam Hossain
RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)
Obama White House
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
wahidullah mudaser
Intro to php
Intro to php
Sp Singh
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Open Gurukul
TravisCIでErlang/OTP (最小構成版)
TravisCIでErlang/OTP (最小構成版)
Masatoshi Itoh
中高生向けUnity講座
中高生向けUnity講座
Makoto Ito
Unityで使うRabbitMQ
Unityで使うRabbitMQ
Masatoshi Itoh
非同期データ更新のためにメッセージキューを導入した(い)話
非同期データ更新のためにメッセージキューを導入した(い)話
Takaaki Hirano
Elixirについて私が知ってる二、三の事柄
Elixirについて私が知ってる二、三の事柄
Tsunenori Oohara
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
Tsunenori Oohara
パーフェクト"Elixir情報収集"
パーフェクト"Elixir情報収集"
Keisuke Takahashi
地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)
Tsunenori Oohara
Weitere ähnliche Inhalte
Was ist angesagt?
Php Lecture Notes
Php Lecture Notes
Santhiya Grace
PHP variables
PHP variables
Siddique Ibrahim
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
Ismail Mukiibi
Php mysql
Php mysql
Alebachew Zewdu
Class 2 - Introduction to PHP
Class 2 - Introduction to PHP
Ahmed Swilam
My cool new Slideshow!
My cool new Slideshow!
omprakash_bagrao_prdxn
slidesharenew1
slidesharenew1
truptitasol
Opa hackathon
Opa hackathon
Henri Binsztok
Intermediate PHP
Intermediate PHP
Bradley Holt
Web 9 | OOP in PHP
Web 9 | OOP in PHP
Mohammad Imam Hossain
RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)
Obama White House
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
wahidullah mudaser
Intro to php
Intro to php
Sp Singh
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Open Gurukul
Was ist angesagt?
(14)
Php Lecture Notes
Php Lecture Notes
PHP variables
PHP variables
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
Php mysql
Php mysql
Class 2 - Introduction to PHP
Class 2 - Introduction to PHP
My cool new Slideshow!
My cool new Slideshow!
slidesharenew1
slidesharenew1
Opa hackathon
Opa hackathon
Intermediate PHP
Intermediate PHP
Web 9 | OOP in PHP
Web 9 | OOP in PHP
RCEC Email 4.7.03 (b)
RCEC Email 4.7.03 (b)
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
Intro to php
Intro to php
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Andere mochten auch
TravisCIでErlang/OTP (最小構成版)
TravisCIでErlang/OTP (最小構成版)
Masatoshi Itoh
中高生向けUnity講座
中高生向けUnity講座
Makoto Ito
Unityで使うRabbitMQ
Unityで使うRabbitMQ
Masatoshi Itoh
非同期データ更新のためにメッセージキューを導入した(い)話
非同期データ更新のためにメッセージキューを導入した(い)話
Takaaki Hirano
Elixirについて私が知ってる二、三の事柄
Elixirについて私が知ってる二、三の事柄
Tsunenori Oohara
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
Tsunenori Oohara
パーフェクト"Elixir情報収集"
パーフェクト"Elixir情報収集"
Keisuke Takahashi
地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)
Tsunenori Oohara
Erlangご紹介 websocket編
Erlangご紹介 websocket編
Masatoshi Itoh
Andere mochten auch
(9)
TravisCIでErlang/OTP (最小構成版)
TravisCIでErlang/OTP (最小構成版)
中高生向けUnity講座
中高生向けUnity講座
Unityで使うRabbitMQ
Unityで使うRabbitMQ
非同期データ更新のためにメッセージキューを導入した(い)話
非同期データ更新のためにメッセージキューを導入した(い)話
Elixirについて私が知ってる二、三の事柄
Elixirについて私が知ってる二、三の事柄
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
Shibuya.ex #1 Elixirを本番環境で使ってみたという事例紹介
パーフェクト"Elixir情報収集"
パーフェクト"Elixir情報収集"
地獄のElixir(目黒スタートアップ勉強会)
地獄のElixir(目黒スタートアップ勉強会)
Erlangご紹介 websocket編
Erlangご紹介 websocket編
Ähnlich wie Getting Rest With Webmachine
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClient
Shinya Mochida
Living With Legacy Code
Living With Legacy Code
Rowan Merewood
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )
Joseph Scott
Presto anatomy
Presto anatomy
Dongmin Yu
iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기
Wanbok Choi
Testing TYPO3 Applications
Testing TYPO3 Applications
André Wuttig
Asynchronous I/O in PHP
Asynchronous I/O in PHP
Thomas Weinert
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
Ladislav Prskavec
How to Write Node.js Module
How to Write Node.js Module
Fred Chien
Lecture: Vaadin Overview
Lecture: Vaadin Overview
Joonas Lehtinen
Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python
Hua Chu
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
Ari Lerner
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
Tatsuhiko Miyagawa
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
NAVER D2
Performance measurement and tuning
Performance measurement and tuning
AOE
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
Anatoly Sharifulin
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
ShaimaaMohamedGalal
Web Scraping with PHP
Web Scraping with PHP
Matthew Turland
Ähnlich wie Getting Rest With Webmachine
(18)
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClient
Living With Legacy Code
Living With Legacy Code
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )
Presto anatomy
Presto anatomy
iOS 개발자의 Flutter 체험기
iOS 개발자의 Flutter 체험기
Testing TYPO3 Applications
Testing TYPO3 Applications
Asynchronous I/O in PHP
Asynchronous I/O in PHP
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
How to Write Node.js Module
How to Write Node.js Module
Lecture: Vaadin Overview
Lecture: Vaadin Overview
Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python
Beginner workshop to angularjs presentation at Google
Beginner workshop to angularjs presentation at Google
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
Performance measurement and tuning
Performance measurement and tuning
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
Lecture2_IntroductionToPHP_Spring2023.pdf
Lecture2_IntroductionToPHP_Spring2023.pdf
Web Scraping with PHP
Web Scraping with PHP
Kürzlich hochgeladen
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Michael W. Hawkins
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Allon Mureinik
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Alan Dix
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Delhi Call girls
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
Sujit Pal
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Principled Technologies
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Pooja Nehwal
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
OnBoard
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
Kürzlich hochgeladen
(20)
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Getting Rest With Webmachine
1.
Getting Some
REST with webmachine Kevin A. Smith
2.
What is webmachine?
3.
Framework
4.
Framework
5.
Toolkit
6.
A toolkit for building
RESTful HTTP resources
7.
What is REST?
8.
Style not a
standard
9.
Resources == URLs
10.
http://localhost:8000/hello_world
11.
http://foo.com/hr/emp/123
12.
GET POST DELETE
PUT
13.
REST is the
shape of the web
14.
-module(hello_world_resource). -export([init/1, to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
15.
-module(hello_world_resource). -export([init/1, to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
16.
-module(hello_world_resource). -export([init/1, to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
17.
-module(hello_world_resource). -export([init/1, to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
18.
-module(hello_world_resource). -export([init/1, to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
19.
A toolkit for
easily building RESTful HTTP resources
20.
GET /test HTTP/1.1 Host:
localhost:8000 User-Agent: Mozilla/5.0 Accept: text/html;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK Server: MochiWeb/1.1 WebMachine/1.3 Date: Mon, 22 Jun 2009 02:27:46 GMT Content-Type: text/html Content-Length: 78
21.
-module(hello_world_resource). -export([init/1, to_html/2]). -export([generate_etag/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}. generate_etag(Req, State) -> {mochihex:to_hex(crypto:md5(State)), Req, State}.
22.
GET /test HTTP/1.1 Host:
localhost:8000 User-Agent: Mozilla/5.0 Accept: text/html;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive HTTP/1.x 200 OK Server: MochiWeb/1.1 WebMachine/1.3 Etag: bc6e6f16b8a077ef5fbc8d59d0b931b9 Date: Mon, 22 Jun 2009 02:29:46 GMT Content-Type: text/html Content-Length: 78
23.
GET /test HTTP/1.1 Host:
localhost:8000 . . . If-None-Match: bc6e6f16b8a077ef5fbc8d59d0b931b9 HTTP/1.x 304 Not Modified Server: MochiWeb/1.1 WebMachine/1.3 Etag: bc6e6f16b8a077ef5fbc8d59d0b931b9 Date: Mon, 22 Jun 2009 02:30:00 GMT
24.
-module(hello_world_resource). -export([init/1, to_html/2]). -export([generate_etag/2, encodings_provided/2]). -include_lib("webmachine/include/webmachine.hrl"). init([])
-> {ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Out, Req, State}. generate_etag(Req, State) -> {mochihex:to_hex(crypto:md5(State)), Req, State}. encodings_provided(Req, State) -> {[{"gzip", fun(X) -> zlib:gzip(X) end}], Req, State}.
25.
GET /test HTTP/1.1 Host:
localhost:8000 . . . Accept-Encoding: gzip,deflate HTTP/1.x 200 OK Server: MochiWeb/1.1 WebMachine/1.3 Etag: bc6e6f16b8a077ef5fbc8d59d0b931b9 Date: Mon, 22 Jun 2009 02:46:57 GMT Content-Type: text/html Content-Length: 71 Content-Encoding: gzip
26.
HTTP Is Hard
27.
28.
29.
PUT ERROR
CODES vs. PO ST O N I TI AT ENC O ODI NEG N GS T T EN IDEMPOTENCY N N IO C O IR AT X P STREA E MING T OVE T EN ET RLOA O N G DED C A L POS O N Ts I TI ND CO
30.
Request Routing
31.
http://foo.com/items {["items"], grocery_item_resource, []}.
URL path Resource module Init params
32.
http://foo.com/items/chocolate {["items", item], grocery_item_resource,
[]}. URL path URL variable Resource module Init params
33.
GET
34.
-module(hello_world_resource). -export([init/1,to_html/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, "Hello, world"}. to_html(Req, State) -> Output = io_lib:format(“<html><body>~s</body></html>”, [State]), {Output, Req, State}.
35.
Must be idempotent
36.
PUT
37.
-module(grocery_list_resource). -export([init/1,allowed_methods/2]). -export([content_types_accepted/2,from_json/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, []}. allowed_methods(Req, State) -> {[‘PUT’], Req, State}. content_types_accepted(Req, State) -> {[{“application/json”, from_json}], Req, State}. from_json(Req, State) -> %% Create/update logic here
38.
DELETE
39.
-module(grocery_list_resource). -export([init/1,allowed_methods/2]). -export([delete_resource/2]). -include_lib("webmachine/include/webmachine.hrl"). init([]) ->
{ok, []}. allowed_methods(Req, State) -> {[‘DELETE’], Req, State}. delete_resource(Req, State) -> %% Deletion logic here
40.
POST
41.
Hmmmm
42.
Problems with
POST
43.
Problems with
POST • Overloaded semantics
44.
Problems with
POST • Overloaded semantics • Create or update?
45.
Creation via
POST •allowed_methods/2 •post_is_create/2 •create_path/2 •content_types_accepted/2 • handler function
46.
Update via
POST •allowed_methods/2 •content_types_accepted/2 • handler function
47.
CODE TIME
48.
HTTP Request
Access
49.
HTTP Request • “Wrapped”
mochiweb request • Separate process for each request • Direct access to: request/response headers, response body, etc.
50.
Other Cool
Stuff • Graphical request debugging • Streaming requests and responses • File uploads
51.
webmachine source:
http://bitbucket.org/justin/webmachine Slides and demo code: http://github.com/kevsmith/erlang_factory/tree/master