dymokomi/luce-http-server
Source of release 0.4.1
## Each worker constructs its own handlers. The server owns thread startup,
## dispatch and shutdown; this factory declares only application behavior.
from luce_server.http import Router, Application
from api import Api
pub func configure(upload_directory: str) -> Application!:
let api = Api(upload_directory)
let router = Router()
router.get("/api/health", api.health)
router.get("/api/items/{id}", api.item)
router.get("/api/greet", api.greet)
router.post("/api/echo", api.echo)
router.put("/api/files/{name}", api.upload)
router.get("/api/files/{name}", api.download)
router.websocket("/ws/echo", api.websocket_echo)
return router.application()