File tree Expand file tree Collapse file tree 9 files changed +88
-2
lines changed
Expand file tree Collapse file tree 9 files changed +88
-2
lines changed Original file line number Diff line number Diff line change 22
33Here are some examples of applications created with Yaframework:
44
5- 1 . [ ** Hello World** ] ( https://github.com/maxbarsukov/yaframework/tree/master/examples/hello-world )
5+ 1 . ### [ Hello World] ( https://github.com/maxbarsukov/yaframework/tree/master/examples/hello-world )
66
77 A simple application that displays "Hello world" to you.
88
99
10- 2 . Be soon...
10+ 2 . ###[ Params] ( https://github.com/maxbarsukov/yaframework/tree/master/examples/params )
11+
12+ Shows how the application parameters can be used
13+
14+
15+ 3 . ###[ Halts and Redirects] ( https://github.com/maxbarsukov/yaframework/tree/master/examples/halts-and-redirects )
16+
17+ Shows how to use halts and redirects
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ source "https://rubygems.org"
4+
5+ gem "yaframework"
Original file line number Diff line number Diff line change 1+ # Params
2+
3+ Shows how to use halts and redirects
4+
5+ ## Installation
6+
7+ Clone this repo and go to this folder.
8+ Then, run ` bundle install ` to install this gem.
9+
10+ ## Run
11+
12+ Run with ` ruby app.rb ` or ` rackup ` and view at http://localhost:4567
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "yaframework"
4+ app = Yaframework ::Application
5+
6+ app . get "/" do
7+ response . redirect "/hello"
8+ end
9+
10+ app . get "/hello" do
11+ "Hello world!"
12+ end
13+
14+ app . get "/error" do
15+ response . status = 401
16+ halt response . finish
17+ end
18+
19+ app . listen ( 4567 )
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "yaframework"
4+ require "./app"
5+
6+ run app
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ source "https://rubygems.org"
4+
5+ gem "yaframework"
Original file line number Diff line number Diff line change 1+ # Params
2+
3+ Shows how the application parameters can be used
4+
5+ ## Installation
6+
7+ Clone this repo and go to this folder.
8+ Then, run ` bundle install ` to install this gem.
9+
10+ ## Run
11+
12+ Run with ` ruby app.rb ` or ` rackup ` and view at http://localhost:4567
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "yaframework"
4+ app = Yaframework ::Application
5+
6+ app . get "/:name" do
7+ "Hello #{ request . params [ :name ] } !"
8+ end
9+
10+ app . get "/:name/foo/:bar" do
11+ "Hello #{ request . params [ :name ] } from #{ request . params [ :bar ] } !"
12+ end
13+
14+ app . listen ( 4567 )
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require "yaframework"
4+ require "./app"
5+
6+ run app
You can’t perform that action at this time.
0 commit comments