Putting legacy to REST with middleware