Skip to content

Commit

Permalink
wertylin
Browse files Browse the repository at this point in the history
  • Loading branch information
selintunr committed Nov 9, 2024
1 parent baad456 commit 5f7ceeb
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 13 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ Please leave a ⭐ as motivation if you liked the implementation 😄
## Running the project
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

In the project directory, you can run:

#### `yarn start`
### Set up environment variables

Get a TMDB API key from [TMDB API](https://www.themoviedb.org/).
You need to create a `.env` file in the root of the project and add the following:
```
TMDB_KEY='your_api_key_here'
```

### Run the project

```
yarn install
yarn build
yarn start
```

It runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
Expand Down
4 changes: 3 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
4 changes: 2 additions & 2 deletions pages/api/discover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default async function handler(request: NextApiRequest, response: NextApi

response.status(200).json({ type: 'Success', data });
} catch (error) {
console.log(error.data);
response.status(500).json({ type: 'Error', data: error.data });
console.error(error);
response.status(500).json({ type: 'Error', data: new Error('Internal Server Error') });
}
}
4 changes: 2 additions & 2 deletions pages/api/popular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function handler(request: NextApiRequest, response: NextApi

response.status(200).json({ type: 'Success', data });
} catch (error) {
console.log(error.data);
response.status(500).json({ type: 'Error', data: error.data });
console.error(error);
response.status(500).json({ type: 'Error', data: new Error('An unexpected error occurred') });
}
}
4 changes: 2 additions & 2 deletions pages/api/trending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function handler(request: NextApiRequest, response: NextApi

response.status(200).json({ type: 'Success', data });
} catch (error) {
console.log(error.data);
response.status(500).json({ type: 'Error', data: error.data });
console.error(error);
response.status(500).json({ type: 'Error', data: new Error('Internal Server Error') });
}
}
19 changes: 15 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -12,8 +16,15 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

0 comments on commit 5f7ceeb

Please sign in to comment.