Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Building a REST API using Python and Flask | Flask-RESTful

Widget Connector
urlhttps://www.youtube.com/watch?v=s_ht4AKnWZg


https://flask-restful.readthedocs.io/en/latest/

1- Install Flask-RESTful

Image Added




https://flask-restful.readthedocs.io/en/latest/quickstart.html#a-minimal-api

Code Block
titlebasic Restful API server
collapsetrue
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

class HelloWorld(Resource):
    def get(self):
        return {'hello': 'world'}

api.add_resource(HelloWorld, '/')

if __name__ == '__main__':
    app.run(debug=True)