mirror of
https://github.com/alopexc0de/Simple-Bookmarking-Service.git
synced 2024-12-22 14:22:39 +00:00
Add simple server
This commit is contained in:
parent
bf41f258b2
commit
33244503e0
12
Pipfile
Normal file
12
Pipfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[[source]]
|
||||||
|
name = "pypi"
|
||||||
|
url = "https://pypi.org/simple"
|
||||||
|
verify_ssl = true
|
||||||
|
|
||||||
|
[dev-packages]
|
||||||
|
|
||||||
|
[packages]
|
||||||
|
bottle = "*"
|
||||||
|
|
||||||
|
[requires]
|
||||||
|
python_version = "3.8"
|
37
server.py
Normal file
37
server.py
Normal file
@ -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/<title>/<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)
|
Loading…
Reference in New Issue
Block a user