Esempio n. 1
0
import falcon
import mongoengine as mongo

# Resources
from resources.user.controller import user

# Middleware
import middlewares

# Init falcon app
app = falcon.API(middleware=[middlewares.JSONTranslator()])

# DB
mongo.connect('admin')

# Routes
app.add_route('/users', user)
app.add_route('/users/{id}', user)
Esempio n. 2
0
from waitress import serve
import mongoengine as mongo
import falcon
import routes.bookRoutes as bookRoutes
import routes.defaultRoutes as defaultRoutes
import middlewares

app = falcon.API(middleware=[
    middlewares.JSONTranslator()
])

bookRoutes.add(app)
defaultRoutes.add(app)

mongo.connect('bookAPI')

serve(app, host='127.0.0.1', port=5000)