Extract render code from server.js