Sinatra example (#51)

This commit is contained in:
Jake Runzer
2021-02-04 19:07:01 -07:00
committed by GitHub
parent 27fa47e398
commit 23635057a9
10 changed files with 103 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ This is a [Ruby on Rails](https://rubyonrails.org/) blog that connects to a Rail
- Connect to your Railway project with `railway init`
- Install Ruby requirements `bundle install`
- Migrate the database `railway run rake db:migrate`
- Run Django `railway run bin/rails migrate`
- Run Rails `railway run bin/rails migrate`
## 📝 Notes

View File

@@ -1,4 +1,4 @@
# Rails Example
# Rails Starter Example
This is a [Ruby on Rails](https://rubyonrails.org/) starter app that connects to a Railway Postgres database.
@@ -16,7 +16,7 @@ This is a [Ruby on Rails](https://rubyonrails.org/) starter app that connects to
- Connect to your Railway project with `railway init`
- Install Ruby requirements `bundle install`
- Migrate the database `railway run rake db:migrate`
- Run Django `railway run bin/rails migrate`
- Run Rails `railway run bin/rails migrate`
## 📝 Notes

36
examples/sinatra/.gitignore vendored Normal file
View File

@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/public/assets
.byebug_history
# Ignore master key for decrypting credentials and more.
/config/master.key
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

6
examples/sinatra/Gemfile Normal file
View File

@@ -0,0 +1,6 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.2'
gem 'sinatra'

View File

@@ -0,0 +1,27 @@
GEM
remote: https://rubygems.org/
specs:
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
rack (2.2.3)
rack-protection (2.1.0)
rack
ruby2_keywords (0.0.4)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
tilt (2.0.10)
PLATFORMS
x86_64-darwin-20
DEPENDENCIES
sinatra
RUBY VERSION
ruby 2.7.2p137
BUNDLED WITH
2.2.8

View File

@@ -0,0 +1 @@
web: ruby app.rb

View File

@@ -0,0 +1,16 @@
# Sinatra Example
This example is a simple [Sinatra](http://sinatrarb.com) webserver.
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fsinatra)
## ✨ Features
- Ruby
- Sinatra
## 💁‍♀️ How to use
- Create Railway project `railway init`
- Install Ruby requirements `bundle install`
- Run Sinatra `railway run ruby app.rb`

5
examples/sinatra/app.rb Normal file
View File

@@ -0,0 +1,5 @@
require 'sinatra'
get '/' do
'Choo Choo! Welcome to your Sinatra server 🚅'
end

View File

@@ -47,7 +47,7 @@
"value": "rocket-rust",
"desc": "Fast webserver written in Rust",
"href": "https://github.com/railwayapp/examples/tree/master/examples/rocket",
"icon": "rust.svg",
"icon": "rocket.svg",
"tags": ["rust"]
},
{
@@ -68,6 +68,14 @@
"icon": "rails.svg",
"tags": ["ruby"]
},
{
"text": "Sinatra",
"value": "sinatra",
"desc": "Lightweight Ruby server",
"href": "https://github.com/railwayapp/examples/tree/master/examples/sinatra",
"icon": "rails.svg",
"tags": ["ruby"]
},
{
"text": "Django Starter",
"value": "django",

BIN
icons/rocket.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB