api now takes the api function, which is then called with the express app