Skip to content

Instantly share code, notes, and snippets.

@juanpabloaj
Created February 4, 2019 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpabloaj/3a8c3eb5c891945820e3de0db8931cb6 to your computer and use it in GitHub Desktop.
Save juanpabloaj/3a8c3eb5c891945820e3de0db8931cb6 to your computer and use it in GitHub Desktop.
hello world with python and flask

Install dependencies

pip install Flask

Run

python service.py

Usage

curl http://localhost:5000
#!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import datetime
from flask import Flask
from flask import jsonify
app = Flask(__name__)
@app.route("/")
def hello():
return jsonify(message="hello world", date=datetime.now())
if __name__ == '__main__':
app.run(host='0.0.0.0')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment