Remove hard coded path 'api' and simplify includes.

- Introduce constants for the root paths.
- Get root paths using realpath.