|
18 | 18 | - Discuss when to use SSR (dynamic data, personalization, etc.) |
19 | 19 | - Discuss when to use SSG (static content, blogs, documentation, etc.) |
20 | 20 |
|
| 21 | +#### Server Components for SSR |
| 22 | + |
| 23 | +- Explain how [Server Components](https://react.dev/reference/rsc/server-components) can speed up load times by directly sending HTML to the browser |
| 24 | +- Introduce the `"use server"` directive, allowing React components to be rendered on the server |
| 25 | + |
21 | 26 | ### When to Use Client vs. Server Components? |
22 | 27 |
|
23 | | -- Explain how Next.js distinguishes client and server components |
| 28 | +- Re-iterate how Next.js distinguishes client and server components (`"use server"` and `"use client"`) |
24 | 29 | - Illustrate how these fit into the SSR and SSG concepts |
25 | 30 |
|
26 | 31 | ### Introduction to Next.js App Router |
|
64 | 69 | - Explain how to access various router properties (push, replace, etc.) |
65 | 70 | - Demonstrate programmatic navigation using `router.push` and `router.replace` |
66 | 71 |
|
67 | | -### Optional Advanced: Server Functions (or Server Actions) & API Routes |
| 72 | +### Advanced: Server Functions & API Routes |
| 73 | + |
| 74 | +#### Server Functions |
| 75 | + |
| 76 | +- Explain Server Functions _(previously "Server Actions")_ as a mechanism to run JavaScript code on the server that hosts the website |
| 77 | +- Discuss how this is different from running JavaScript in the user's browser |
| 78 | +- Reference [the React docs for Server Functions](https://react.dev/reference/rsc/server-functions) demonstrating how to use them |
| 79 | + |
| 80 | +#### Server Components |
| 81 | + |
| 82 | +- Discuss how Server Components allow the use of Server Functions inside the component |
| 83 | +- Explain that client components can use Server Functions by importing them from a file with the `"use server"` directive |
68 | 84 |
|
69 | | -TODO: … |
| 85 | +#### Server Actions |
| 86 | + |
| 87 | +- Introduce "Server Actions" as a specific type of Server Function |
| 88 | +- Provide context by mentioning plain old `<form>`s on the internet that can be sent to a server for processing (we could call them "server functions"!) |
| 89 | +- Explain how attaching a Server _Function_ to a (form) `action` makes it a Server _Action_ |
| 90 | + |
| 91 | +#### API Routes |
| 92 | + |
| 93 | +- Explain how Next.js supports Server Actions and Server Components as React features |
| 94 | +- Introduce API routes as a concept from the backend side of web development |
| 95 | +- Provide an overview of [Route Handlers](https://nextjs.org/docs/app/getting-started/route-handlers) and how they allow to create an API route that returns JSON |
| 96 | +- [_(The concept of APIs is covered in detail in the backend specialization)_](/courses/backend/node/README.md) |
70 | 97 |
|
71 | 98 | ## Vercel |
72 | 99 |
|
73 | 100 | ### Introducing Vercel & Good Use Cases |
74 | 101 |
|
75 | | -TODO: … |
| 102 | +- Introduce Vercel as the company behind Next.js, as well as a provider of cloud infrastructure |
| 103 | +- Explain how Vercel's hosting options allow developers to host Next.js applications with very little effort |
| 104 | +- Highlight that hosting on Vercel is a good fit for a prototype or portfolio website built with React and/or Next.js |
76 | 105 |
|
77 | 106 | ### Connecting a GitHub Repository With Vercel |
78 | 107 |
|
79 | | -TODO: … |
| 108 | +- Demonstrate in the browser how a **public** GitHub repository from ones account can be connected to Vercel and deployed with the click of a button |
| 109 | +- Illustrate one way to get started with Vercel by installing the Vercel CLI globally `npm -g vercel` |
| 110 | +- Show logging in to Vercel using `vercel login` and using ones GitHub account |
| 111 | +- Show how one can deploy a local folder with a Next.js app using the `vercel deploy` CLI command |
80 | 112 |
|
81 | 113 | ### Limitations of Vercel |
82 | 114 |
|
83 | | -TODO: … |
| 115 | +- Mention that Vercel probably works best for hosting Next.js applications or static websites |
| 116 | +- Discuss how other frameworks are supported, but that the focus is likely on Next.js |
| 117 | +- Mention that knowledge about DNS, domains, npm, dependencies etc. is not required, but useful when managing a site on Vercel |
| 118 | +- Highlight that Vercel is well-suited for production applications, but that prices can apparently vary a lot based on usage |
84 | 119 |
|
85 | 120 | ## Exercises |
86 | 121 |
|
@@ -151,7 +186,7 @@ TODO: … |
151 | 186 | - Does it show the time? |
152 | 187 | - [Refer to the docs when in doubt](https://nextjs.org/docs/app/getting-started/updating-data#creating-server-functions) |
153 | 188 |
|
154 | | -#### API Routes |
| 189 | +#### Trying out API Routes |
155 | 190 |
|
156 | 191 | - Create a Hello World API route at `/api/hello` that returns the following JSON |
157 | 192 |
|
|
0 commit comments