getInitialProps: with catch-all routing

This page uses getInitialProps() to fetch a TV show from an API.
It uses catch-all routing.

URL parameters are made available in getInitialProps:
[0]: 83
[1]: catch
[2]: all
[3]: routing

The first URL parameter determines the ID of the TV show to fetch.

You can change the URL to anything else, such as /getInitialProps/1871/whatever/path/you/want. Try it!

View code on GitHub

Show #83: The Simpsons

https://api.tvmaze.com/shows/83

Type: Animation
Language: English
Status: Running
Premiered: 1989-12-17
Official Site: http://www.fox.com/the-simpsons/full-episodes
Rating (average): 8.1


Go back home