Renamed ports to port.
Moved api route logic to middlewares.