added template controller functions and routes to server side