API route function.
wip. Can pass config to handlers in routes.