Reorganize the server sample code and update the documentation