Skip to content

Commit ad83ea9

Browse files
authored
feat: proxy tv maze api (#1863)
1 parent 05ae395 commit ad83ea9

File tree

21 files changed

+284
-278
lines changed

21 files changed

+284
-278
lines changed

demos/default/pages/api/shows/[...params].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default async (req, res) => {
1010
const id = params[0]
1111

1212
// Get the data
13-
const fetchRes = await fetch(`https://api.tvmaze.com/shows/${id}`)
13+
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
1414
const data = await fetchRes.json()
1515

1616
// If show was found, return it

demos/default/pages/api/shows/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default async (req, res) => {
77
const { id } = query
88

99
// Get the data
10-
const fetchRes = await fetch(`https://api.tvmaze.com/shows/${id}`)
10+
const fetchRes = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
1111
const data = await fetchRes.json()
1212

1313
// If show was found, return it

demos/default/pages/deep/import.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const Show = ({ show }) => (
2525
)
2626

2727
export const getServerSideProps = async ({ params }) => {
28-
const res = await fetch('https://api.tvmaze.com/shows/42')
28+
const res = await fetch('https://tvproxy.netlify.app/shows/42')
2929
const data = await res.json()
3030

3131
return {

demos/default/pages/getServerSideProps/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const getServerSideProps = async ({ params }) => {
3434
// The ID to render
3535
const { id } = params
3636

37-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
37+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3838
const data = await res.json()
3939

4040
// Set error code if show item could not be found

demos/default/pages/getServerSideProps/all/[[...slug]].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const getServerSideProps = async ({ params }) => {
3434
// The ID to render
3535
const { slug } = params
3636

37-
const res = await fetch(`https://api.tvmaze.com/shows/${slug[0]}`)
37+
const res = await fetch(`https://tvproxy.netlify.app/shows/${slug[0]}`)
3838
const data = await res.json()
3939

4040
// Set error code if show item could not be found

demos/default/pages/getServerSideProps/static.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Show = ({ show }) => (
2222
)
2323

2424
export const getServerSideProps = async ({ params }) => {
25-
const res = await fetch('https://api.tvmaze.com/shows/42')
25+
const res = await fetch('https://tvproxy.netlify.app/shows/42')
2626
const data = await res.json()
2727

2828
return {

demos/default/pages/getStaticProps/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export async function getStaticProps({ params }) {
2828
// The ID to render
2929
const { id } = params
3030

31-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
31+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3232
const data = await res.json()
3333
const time = new Date().toLocaleTimeString()
3434

demos/default/pages/getStaticProps/static.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Show = ({ show }) => (
1616
)
1717

1818
export async function getStaticProps(context) {
19-
const res = await fetch(`https://api.tvmaze.com/shows/71`)
19+
const res = await fetch(`https://tvproxy.netlify.app/shows/71`)
2020
const data = await res.json()
2121

2222
return {

demos/default/pages/getStaticProps/with-revalidate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Show = ({ show }) => (
1616
)
1717

1818
export async function getStaticProps(context) {
19-
const res = await fetch(`https://api.tvmaze.com/shows/71`)
19+
const res = await fetch(`https://tvproxy.netlify.app/shows/71`)
2020
const data = await res.json()
2121

2222
return {

demos/default/pages/getStaticProps/withFallback/[...slug].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function getStaticProps({ params }) {
4242
const { slug } = params
4343
const id = slug[slug.length - 1]
4444

45-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
45+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
4646
const data = await res.json()
4747
const time = new Date().toLocaleTimeString()
4848

demos/default/pages/getStaticProps/withFallback/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function getStaticProps({ params }) {
4141
// The ID to render
4242
const { id } = params
4343

44-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
44+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
4545
const data = await res.json()
4646
const time = new Date().toLocaleTimeString()
4747

demos/default/pages/getStaticProps/withFallbackBlocking/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function getStaticProps({ params }) {
3030
// The ID to render
3131
const { id } = params
3232

33-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
33+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3434
const data = await res.json()
3535
const time = new Date().toLocaleTimeString()
3636

demos/default/pages/getStaticProps/withRevalidate/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function getStaticProps({ params }) {
2929
// The ID to render
3030
const { id } = params
3131

32-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
32+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3333
const data = await res.json()
3434
const time = new Date().toLocaleTimeString()
3535

demos/default/pages/getStaticProps/withRevalidate/withFallback/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function getStaticProps({ params }) {
4242
// The ID to render
4343
const { id } = params
4444

45-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
45+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
4646
const data = await res.json()
4747
const time = new Date().toLocaleTimeString()
4848

demos/default/pages/getStaticProps/withRevalidate/withFallbackBlocking/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function getStaticProps({ params }) {
2929
// The ID to render
3030
const { id } = params
3131

32-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
32+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3333
const data = await res.json()
3434
const time = new Date().toLocaleTimeString()
3535

demos/default/pages/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ Index.getInitialProps = async function () {
183183
const randomPage = Math.floor(Math.random() * 100) + 1
184184
// FIXME: stub out in dev
185185
const server = dev
186-
? `https://api.tvmaze.com/shows?page=${randomPage}`
187-
: `https://api.tvmaze.com/shows?page=${randomPage}`
186+
? `https://tvproxy.netlify.app/shows/page/${randomPage}`
187+
: `https://tvproxy.netlify.app/shows/page/${randomPage}`
188188

189189
// Get the data
190190
const res = await fetch(server)

demos/default/pages/shows/[...params].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ CatchAll.getInitialProps = async ({ res: req, query }) => {
4747
const id = params[0]
4848

4949
// Get the data
50-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
50+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
5151
const data = await res.json()
5252

5353
// Set error code if show item could not be found

demos/default/pages/shows/[id].js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Show.getInitialProps = async ({ res: req, query }) => {
3535
const { id } = query
3636

3737
// Get the data
38-
const res = await fetch(`https://api.tvmaze.com/shows/${id}`)
38+
const res = await fetch(`https://tvproxy.netlify.app/shows/${id}`)
3939
const data = await res.json()
4040

4141
// Set error code if show item could not be found

0 commit comments

Comments
 (0)