mirror of
https://github.com/allankoechke/tutorials.git
synced 2026-11-30 17:27:11 +00:00
23 lines
449 B
Python
23 lines
449 B
Python
# Product Service
|
|
|
|
# Import framework
|
|
from flask import Flask
|
|
from flask_restful import Resource, Api
|
|
|
|
# Instantiate the app
|
|
app = Flask(__name__)
|
|
api = Api(app)
|
|
|
|
class Product(Resource):
|
|
def get(self):
|
|
return {
|
|
'products': ['Ice cream', 'Chocolate', 'Fruit', 'Eggs']
|
|
}
|
|
|
|
# Create routes
|
|
api.add_resource(Product, '/')
|
|
|
|
# Run the application
|
|
if __name__ == '__main__':
|
|
app.run(host='0.0.0.0', port=80, debug=True)
|