route.js

Thie special file route.js designates a route segment as an API end-point.

For instance, if you place this file at /data/route.js, you can then fetch data from /data via HTTP methods such as GET or POST.

A route segment must not contain both a route.js file and a page.js file at the same time.

Read more about Route Handlers in the next section of this tutorial.

Refresh the page to see the increase in the number of visits.