Created
March 22, 2016 19:28
-
-
Save vortec/861b2b83401ddcb76fe5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Will be started via hug -m | |
import endpoints | |
import hug | |
from libtree import Tree | |
from libtree.core.database import make_dsn_from_env | |
import psycopg2 | |
import os | |
dsn = make_dsn_from_env(os.environ) | |
connection = psycopg2.connect(dsn) | |
tree = Tree(connection) | |
make_directive('tree', tree) | |
@hug.extend_api('/cms') | |
def cms_api(): | |
return [endpoints.cms] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hug | |
@hug.post('/add_object') | |
def add_object(tree: needs_magic_here.tree, title, parent): | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment