Skip to content

Instantly share code, notes, and snippets.

@vortec
Created March 22, 2016 19:28
Show Gist options
  • Save vortec/861b2b83401ddcb76fe5 to your computer and use it in GitHub Desktop.
Save vortec/861b2b83401ddcb76fe5 to your computer and use it in GitHub Desktop.
# 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]
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