
# Third Party Libs
from flask import Flask
from flask_hal import HAL, document


app = Flask(__name__)
HAL(app)  # Initialise HAL


@app.route('/foo')
def foo():
    d = document.Document(data={
        'foo': 'bar'
    })

    return d.to_json()

if __name__ == "__main__":
    app.run()


# Third Party Libs
from flask import Flask
from flask_hal import HAL, document


app = Flask(__name__)
HAL(app)  # Initialise HAL


@app.route('/hello')
def foo():
    return document.Document(data={
        'message': 'Hello World'
    })


if __name__ == "__main__":
    app.run()

Update to hello world example
Update to hello world example

  
  # Third Party Libs
  from flask import Flask
  from flask_hal import HAL, document
  
  
  app = Flask(__name__)
  HAL(app)  # Initialise HAL
  
  
- @app.route('/foo')
+ @app.route('/hello')
  def foo():
-     d = document.Document(data={
+     return document.Document(data={
-         'foo': 'bar'
+         'message': 'Hello World'
      })
  
-     return d.to_json()
  
  if __name__ == "__main__":
      app.run()
  
Update to hello world example
## Code Before:

# Third Party Libs
from flask import Flask
from flask_hal import HAL, document


app = Flask(__name__)
HAL(app)  # Initialise HAL


@app.route('/foo')
def foo():
    d = document.Document(data={
        'foo': 'bar'
    })

    return d.to_json()

if __name__ == "__main__":
    app.run()

## Instruction:
Update to hello world example
## Code After:

# Third Party Libs
from flask import Flask
from flask_hal import HAL, document


app = Flask(__name__)
HAL(app)  # Initialise HAL


@app.route('/hello')
def foo():
    return document.Document(data={
        'message': 'Hello World'
    })


if __name__ == "__main__":
    app.run()
