API mocking for client JavaScript applications