From c0e5d01b61f0542d00c1c5a4581bb8a68f02185a Mon Sep 17 00:00:00 2001 From: Jiganesh Date: Sat, 7 Oct 2023 16:24:09 +0530 Subject: [PATCH] First commit --- pages/api/hello.js | 5 -- pages/chess.js | 51 ++++++++++++++++++++ pages/index.js | 114 --------------------------------------------- 3 files changed, 51 insertions(+), 119 deletions(-) create mode 100644 pages/chess.js diff --git a/pages/api/hello.js b/pages/api/hello.js index df63de8..e69de29 100644 --- a/pages/api/hello.js +++ b/pages/api/hello.js @@ -1,5 +0,0 @@ -// Next.js API route support: https://nextjs.org/docs/api-routes/introduction - -export default function handler(req, res) { - res.status(200).json({ name: 'John Doe' }) -} diff --git a/pages/chess.js b/pages/chess.js new file mode 100644 index 0000000..f29a9e3 --- /dev/null +++ b/pages/chess.js @@ -0,0 +1,51 @@ + + +async function get_stats(){ + + + const inputfieldname = document.getElementById("username") + const username = inputfieldname.value + + console.log(username) + const player_details_url = `https://api.chess.com/pub/player/${username}` + const player_details_response = await fetch(player_details_url) + + const player_details = await player_details_response.json(); + + document.querySelector("#avatar_image").src = player_details.avatar + document.querySelector("#avatar_name").innerHTML = player_details.name + + + + + + let dictionary = { + photo : player_details.avatar, + name : player_details.name, + username: player_details.username, + location: player_details.location, + league : player_details.league + } + + + + + return dictionary + +} + +function Chess(){ + + return ( +
+ + + + + + +
+ ) +} + +export default Chess \ No newline at end of file diff --git a/pages/index.js b/pages/index.js index b76a1de..e69de29 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,114 +0,0 @@ -import Head from 'next/head' -import Image from 'next/image' -import { Inter } from 'next/font/google' -import styles from '@/styles/Home.module.css' - -const inter = Inter({ subsets: ['latin'] }) - -export default function Home() { - return ( - <> - - Create Next App - - - - -
-
-

- Get started by editing  - pages/index.js -

-
- - By{' '} - Vercel Logo - -
-
- -
- Next.js Logo -
- -
- -

- Docs -> -

-

- Find in-depth information about Next.js features and API. -

-
- - -

- Learn -> -

-

- Learn about Next.js in an interactive course with quizzes! -

-
- - -

- Templates -> -

-

- Discover and deploy boilerplate example Next.js projects. -

-
- - -

- Deploy -> -

-

- Instantly deploy your Next.js site to a shareable URL - with Vercel. -

-
-
-
- - ) -}