├── .gitignore ├── README.md ├── components ├── ArticleItem.js ├── ArticleList.js ├── Header.js ├── Layout.js ├── Meta.js └── Nav.js ├── config └── index.js ├── data.js ├── package-lock.json ├── package.json ├── pages ├── _app.js ├── _document.js ├── about.js ├── api │ └── articles │ │ ├── [id].js │ │ └── index.js ├── article │ └── [id] │ │ └── index.js └── index.js ├── public ├── favicon.ico └── vercel.svg └── styles ├── Article.module.css ├── Header.module.css ├── Layout.module.css ├── Nav.module.css └── globals.css /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Next.js Crash Course Project 2 | 3 | Project from my Next.js crash course on YouTube 4 | 5 | ### Run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | ``` 10 | 11 | ### Build for production AND generate static website into "out" folder: 12 | 13 | ```bash 14 | npm run build 15 | ``` 16 | 17 | ### Run in production: 18 | 19 | ```bash 20 | npm start 21 | ``` 22 | 23 | ### API Routes: 24 | 25 | GET /api/articles 26 | GET /api/articles/:id 27 | -------------------------------------------------------------------------------- /components/ArticleItem.js: -------------------------------------------------------------------------------- 1 | import Link from 'next/link' 2 | import articleStyles from '../styles/Article.module.css' 3 | 4 | const ArticleItem = ({ article }) => { 5 | return ( 6 | 7 | 8 |

{article.title} →

9 |

{article.excerpt}

10 |
11 | 12 | ) 13 | } 14 | 15 | export default ArticleItem 16 | -------------------------------------------------------------------------------- /components/ArticleList.js: -------------------------------------------------------------------------------- 1 | import ArticleItem from './ArticleItem' 2 | import articleStyles from '../styles/Article.module.css' 3 | 4 | const ArticleList = ({ articles }) => { 5 | return ( 6 |
7 | {articles.map((article) => ( 8 | 9 | ))} 10 |
11 | ) 12 | } 13 | 14 | export default ArticleList 15 | -------------------------------------------------------------------------------- /components/Header.js: -------------------------------------------------------------------------------- 1 | import headerStyles from '../styles/Header.module.css' 2 | 3 | const Header = () => { 4 | return ( 5 |
6 |

7 | WebDev News 8 |

9 |

10 | Keep up to date with the latest web dev news 11 |

12 |
13 | ) 14 | } 15 | 16 | export default Header 17 | -------------------------------------------------------------------------------- /components/Layout.js: -------------------------------------------------------------------------------- 1 | import Nav from './Nav' 2 | import Meta from './Meta' 3 | import Header from './Header' 4 | import styles from '../styles/Layout.module.css' 5 | 6 | const Layout = ({ children }) => { 7 | return ( 8 | <> 9 | 10 |