Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/armcknight/sinatra-hello-world
A simple Hello, World! server app using Sinatra.
https://github.com/armcknight/sinatra-hello-world
Last synced: 24 days ago
JSON representation
A simple Hello, World! server app using Sinatra.
- Host: GitHub
- URL: https://github.com/armcknight/sinatra-hello-world
- Owner: armcknight
- License: mit
- Created: 2018-09-25T23:28:54.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T05:48:05.000Z (over 1 year ago)
- Last Synced: 2023-08-07T02:14:17.552Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 1.94 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sinatra-hello-world
A simple βHello world!β [Sinatra](http://sinatrarb.com) app that works with [`rbenv`](https://github.com/rbenv/rbenv).
## Create from scratch
```sh
# create the Sinatra source
echo "require 'sinatra'
get '/' do
'Hello world!'
end" > api.rb# declare dependencies
echo "source 'https://rubygems.org'
gem 'sinatra'
gem 'unicorn'
gem 'json'" > Gemfile
# install and package dependencies
rbenv exec bundle package --path=vendor/bundle# create a Procfile and config.ru for Heroku
echo "web: bundle exec unicorn --port \$PORT
local: rbenv exec bundle exec unicorn --port \$PORT" > Procfileecho "require './api'
run Sinatra::Application" > config.ru
```## Deployment
### Local
```sh
rbenv exec bundle exec ruby api.rb &
open http://localhost:4567
```### Locally with Heroku
```sh
heroku local local &
open http://0.0.0.0:5000
```## Remote
### Heroku
```sh
heroku create # make sure your βherokuβ git remote points to the correct app's git url, like if there was a previous one
git push heroku master
heroku open
```## References
- [Sinatra getting started guide](http://sinatrarb.com/intro.html)
- [Heroku Sinatra-iOS guide](https://devcenter.heroku.com/articles/getting-started-ios-development-sinatra-cedar)> Note: References preserved as PDFs in `docs/`.
# Contribute
Issues and pull requests are welcome!
If this project helped you, please consider leaving a tip π€
Do you need help with a project? [I'm currently available for hire or contract.](http://tworingsoft.com/contracts).