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

38 lines
866 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
@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 = [
{
"name": "Flask",
"url": "https://flask.palletsprojects.com/",
"language": "Python",
},
{
"name": "Vue.js",
"url": "https://vuejs.org/",
"language": "JavaScript",
},
{
"name": "Quasar Framework",
2020-04-04 00:35:39 +01:00
"url": "https://quasar.dev/",
2020-04-03 22:28:25 +02:00
"language": "JavaScript",
}
]
return jsonify(tools), HTTPStatus.OK