Skip to content

Commit

Permalink
Update README.md and add hello world app
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexB52 committed Apr 19, 2024
1 parent c350f24 commit 3aae45f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ Check out our [examples](/examples) to understand how the library creates Rails

See some examples of how the UniRails library can be used

- [Todos app (JSON API)](/examples/json_api.rb)
- [Todos app (Rails scaffold)](/examples/todos.rb) based off `bin/rails g scaffold todo name completed_at:datetime`
- [Todos app (Hotwire)](/examples/hotwire.rb) based off online article: [turbo-rails-101-todo-list](https://www.colby.so/posts/turbo-rails-101-todo-list) by David Colby
- [App using Puma server](/examples/server_puma.rb)
- [App using Falcon server](/examples/server_falcon.rb)
- [Hello world](/examples/hello-world.rb)
- [Todos app (JSON API)](/examples/todos-api.rb)
- [Todos app (Rails scaffold)](/examples/todos-scaffold.rb) based off `bin/rails g scaffold todo name completed_at:datetime`
- [Todos app (Hotwire)](/examples/todos-hotwire.rb) based off online article: [turbo-rails-101-todo-list](https://www.colby.so/posts/turbo-rails-101-todo-list) by David Colby
- [App using Puma server](/examples/server-puma-app.rb)
- [App using Falcon server](/examples/server-falcon-app.rb)

## Development

Expand Down
25 changes: 25 additions & 0 deletions examples/hello-world.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Run the application
# $ ruby hello-world.rb

ENV['SECRET_KEY_BASE'] = 'my_secret_key_base'

require "bundler/inline"

gemfile(true) do
source "https://rubygems.org"
gem 'uni_rails'
end

require 'uni_rails'

UniRails::App.routes.append do
root 'pages#index'
end

class PagesController < ActionController::Base
def index
render plain: 'Hello world'
end
end

UniRails.run(Port: 3000)

0 comments on commit 3aae45f

Please sign in to comment.