lnbits-legend/lnbits/extensions/example/views_api.py

27 lines
730 B
Python
Raw Normal View History

2020-04-03 22:28:25 +02:00
# views_api.py is for you API endpoints that could be hit by another service
2020-02-19 23:21:01 +00:00
2020-04-03 22:28:25 +02:00
# add your dependencies here
2020-02-19 23:21:01 +00:00
2020-04-03 22:28:25 +02:00
# import json
# import requests
from flask import jsonify
from http import HTTPStatus
2020-04-03 22:28:25 +02:00
2020-02-19 23:21:01 +00:00
from lnbits.extensions.example import example_ext
2020-04-03 22:28:25 +02:00
# add your endpoints here
2020-08-30 23:19:43 -03:00
2020-04-03 22:28:25 +02:00
@example_ext.route("/api/v1/tools", methods=["GET"])
2020-02-19 23:21:01 +00:00
def api_example():
"""Try to add descriptions for others."""
2020-04-03 22:28:25 +02:00
tools = [
2020-08-30 23:19:43 -03:00
{"name": "Flask", "url": "https://flask.palletsprojects.com/", "language": "Python",},
{"name": "Vue.js", "url": "https://vuejs.org/", "language": "JavaScript",},
{"name": "Quasar Framework", "url": "https://quasar.dev/", "language": "JavaScript",},
2020-04-03 22:28:25 +02:00
]
return jsonify(tools), HTTPStatus.OK