Introduce a way to define custom function into route

I need to be able to create custom function to do custom things outside Textpress.