There are several ways to perform routing. RouteLayer is a layer for visualizing and solving routes. A solved route includes turn-by-turn directions, and can be stored and retrieved from ArcGIS Online or Enterprise, either as a portal item, or as part of a webmap.
The route module uses ArcGIS Server network analysis services to calculate routes between two or more locations and optionally get driving directions. Network analysis services allow you to solve simple routing problems as well as complex ones that take into account multiple stops, barriers, and time windows.
The Directions widget provides a way to calculate directions
between two or more input locations with a RouteLayer,
using ArcGIS Online and custom Network Analysis Route services. Similar to how
route works, this widget generates a
route finding a least-cost path between multiple points using a specified routing service. The resulting directions
are displayed with detailed turn-by-turn instructions.
Introduction to routing and directions
Introduction to routing and directions.
Directions widget sample.