I argued that it was not that much plumbing with modern frameworks or with project templates (like yeoman ones) and that deployment had been heavily simplified in environments like Heroku.
So, in this quick & dirty post I will try to prove my point building a simple HTTP server exposing a Hello-World HTTP API.
Creating the app:
➜ echo "import osfrom flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 5000)))" > app.py
➜ echo "flask" > requirements.txt
➜ echo "web: python app.py" > Procfile
Initializing the source control (git) and comiting the changes:
➜ git initInitialized empty Git repository in /Users/ggb/projects/rgb/.git/
➜ git add *
➜ git commit -m "First version"
Deploying to production:
➜ heroku create rgb-ggbCreating ⬢ rgb-ggb... done
https://rgb-ggb.herokuapp.com/ | https://git.heroku.com/rgb-ggb.git
➜ git push heroku master *
Try It!: https://rgb-ggb.herokuapp.com/
Summary:
Code: 7 LoC (4 is the plumbing of starting the server and it has to be done only once)
Deployment: 1 file (Procfile) to tell heroku how to start your app (this is not needed for node.js apps and could be autogenerated with a yeoman template) + 1 git push command in the console (and a "heroku create" command the first time)
What does rgb stand for?
ResponderEliminarthe initials of the guy (much smarter than me) i was discussing with about this topic :)
ResponderEliminar