Last active
April 5, 2021 18:37
-
-
Save nmagee/12c989a8119ba826612403f024507a20 to your computer and use it in GitHub Desktop.
Hello World Flask API for Lightsail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3 | |
ADD helloworld.py / | |
RUN pip install flask | |
RUN pip install flask_restful | |
EXPOSE 80 | |
CMD [ "python", "./helloworld.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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