Templating (ejs-locals), server file style.

Made templating work, rearranged server file to keep difference between database stuff and server stuff.
Did this in a rush, should be changed to real version numbers.