Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
refactor: use /src folder
Browse files Browse the repository at this point in the history
  • Loading branch information
peterleiva committed Aug 18, 2021
1 parent ca5ab16 commit 1d360d9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
7 changes: 0 additions & 7 deletions pages/_app.tsx

This file was deleted.

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

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
export default MyApp;
8 changes: 4 additions & 4 deletions pages/api/hello.ts → src/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
name: string
}
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
res.status(200).json({ name: "John Doe" });
}
15 changes: 9 additions & 6 deletions pages/index.tsx → src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Head from 'next/head'
import Image from 'next/image'
import styles from '../styles/Home.module.css'
import Head from "next/head";
import Image from "next/image";
import styles from "styles/Home.module.css";
import { useEffect, useState } from "react";

export default function Home() {
const [state, setState] = useState(0);

return (
<div className={styles.container}>
<Head>
Expand All @@ -17,7 +20,7 @@ export default function Home() {
</h1>

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

Expand Down Expand Up @@ -58,12 +61,12 @@ export default function Home() {
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
Powered by{" "}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
</div>
)
);
}
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"baseUrl": "./src"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
Expand Down

0 comments on commit 1d360d9

Please sign in to comment.