Added an API endpoint /events.
Supports POST and GET operations.