Skip to content

Instantly share code, notes, and snippets.

@nmagee
Last active April 5, 2021 18:37
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 nmagee/12c989a8119ba826612403f024507a20 to your computer and use it in GitHub Desktop.
Save nmagee/12c989a8119ba826612403f024507a20 to your computer and use it in GitHub Desktop.
Hello World Flask API for Lightsail
FROM python:3
ADD helloworld.py /
RUN pip install flask
RUN pip install flask_restful
EXPOSE 80
CMD [ "python", "./helloworld.py"]
from flask import Flask, request
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Greeting (Resource):
def get(self):
return { "message" : "Hello peeps!" }
api.add_resource(Greeting, '/') # Route_1
if __name__ == '__main__':
app.run('0.0.0.0','80')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment