As Dong Nguyen stated, you'll probably need a reverse-proxy to map your API container to the myapp.com/api location. I'd recommend using Nginx, have a look at Frank Rousseau's answer below for an example with Nginx.
In addition to that, I wanted to recommend you a few things:
Using the --link option to link container is deprecated since Docker 1.9 and will probably be removed in future versions: docs.docker.com/engine/userguide/networking/defau…
What you should do instead is to create your own Docker network and start your containers inside that network. Containers started inside a user-defined network will be able to communicate by using their container names.
Here is a small example:
$ docker network create myapp
$ docker run -d -p 27017:27017 --name mongodb mongo
$ docker run -d -p 3000:3000 --name backend myapp/backend
$ docker run -d -p 80:80 --name frontend myapp/frontend
Compose is tool for defining and running multi-container Docker application. You'll be able to define what services (mongodb, backend, frontend) that make up your app in a single YAML file and manage it using a single command-line. It's pretty handy ! Have a look here for more information: docs.docker.com/compose/overview