Switches deal with data exchanges within your network but routers are different. They provide a way to exchange data between a variety of different networks. As such, they are set up at gateway points where two networks are connected.
A classic example of this type of set up would be connecting your home LAN network to your ISP internet provider. Routers have a further level of intelligence compared to hubs and can provide a number of different services. For instance, they can be used for several ethernet ports.
They can also translate multiple IP addresses on the internal network and ensure that they appear as one IP address. That IP address can then be used when accessing the larger internet network. As well as this when data arrives from the public facing IP, this is then changed into the internal IP.
Furthermore, A DNS will be part of your router and ensure that domain names are converted into IP addresses. This ensures that a router does know where outgoing traffic should be directed.
More info: router vs switch