Skip to content

Commit

Permalink
chore: 既存コードをTypeScriptに書き換え (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
nandenjin committed Oct 1, 2020
1 parent 10e747e commit 5ac94d1
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 73 deletions.
7 changes: 0 additions & 7 deletions pages/_app.js

This file was deleted.

6 changes: 6 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { AppProps } from 'next/app'
import '../styles/globals.css'

const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => <Component {...pageProps} />

export default MyApp
4 changes: 3 additions & 1 deletion pages/api/hello.js → pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

export default (req, res) => {
import { NextApiRequest, NextApiResponse } from 'next'

export default (_: NextApiRequest, res: NextApiResponse) => {
res.statusCode = 200
res.json({ name: 'John Doe' })
}
65 changes: 0 additions & 65 deletions pages/index.js

This file was deleted.

64 changes: 64 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import Head from 'next/head'
import styles from '../styles/Home.module.css'

const app: React.FC = () =>
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>

<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.js</code>
</p>

<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>

<a
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>

<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
</a>
</footer>
</div>

export default app

0 comments on commit 5ac94d1

Please sign in to comment.