server code preparation