diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..f3e7b64 --- /dev/null +++ b/Pipfile @@ -0,0 +1,12 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +bottle = "*" + +[requires] +python_version = "3.8" diff --git a/server.py b/server.py new file mode 100644 index 0000000..e49c12f --- /dev/null +++ b/server.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# Copyright 2020 - David Todd (c0de@c0defox.es) +# Licensed under the MIT License (https://opensource.org/licenses/MIT) + +""" + This file contains the web server for a simple bookmarking application +""" + +from bottle import Bottle, run, response, route, template +from api import API + +_api = API() + +@route('/') +def index(): + return template("This is the index") + +# I haven't figured out how to get these routes inside the API yet... +@route('/save//<uri:path>') +def save_bookmark(title, uri): + return _api.save_bookmark(title, uri) + +@route('/getall') +@route('/get/all') +def get_all_bookmarks(): + return _api.get_all_bookmarks() + +@route('/get/<bookmark_id>') +def get_bookmark(bookmark_id): + return _api.get_bookmark(bookmark_id) + +@route('/delete/<bookmark_id>') +def delete_bookmark(bookmark_id): + return _api.delete_bookmark(bookmark_id) + +if __name__ == '__main__': + run(host='localhost', port=8080)