Use ui.write in server, move ui.js into ui folder as index.js