Handling GET and POST requests