Added method to handle delete URL.
Optimized the structure of server-side code.