-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
Sinatra is a lightweight Web Application Framework that makes it fun and easy to make web applications.
This week we're going to get our very first web application running on Heroku so anyone on the web can use it!
- Get the playground application running on your machine.
- Publish it to Heroku.
- Add your own features!
- Publish it to Heroku.
- Share it with your friends and family.
- Brag about your mad skills!
- GoTo "Add your own features!"
Heroku is a service that makes it really easy to put ruby web applications online. To get this app running on heroku:
- Follow steps 1-3 in Heroku's Getting Started Guide
-
heroku create
- This creates a new application on heroku's servers -
git push heroku master
- This pushes the contents of your git repo to Heroku -
heroku open
- This opens your newly published application in your browser
Look it that! The app is online.
Unfortunately, the twitter integration isn't working yet. Go ahead. Try it. See that Internal Server Error
message? That's heroku protecting you.
When errors happen on your machine they show up directly in your browser. Applications running on a public server should never show their errors to public users. Instead, run heroku logs
from within your project directory to see the error message.
Ah yes! We need to set our environment variables! When we're running the app locally, we can use dotenv
to load our environment variables. On Heroku, we need to use heroku config:set
to provide our secrets to our apps.
Go ahead and run: heroku config:set TWITTER_API_KEY="y0re4p1k3y" TWITTER_API_SECRET="y0r3ap1s3cr37"
(but use your API keys and secrets).
Now go for it! Play around with Sinatra. Explore creating web forms and making code available on the Internet!