Fixed server.js to correctly handle POST and GET requests