fix immediate invocation, move app.get to top level