Skip to content

Commit 5ba1245

Browse files
committed
Add ToC to Lecture 4
1 parent ab5a657 commit 5ba1245

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

Lecture 4 - Databases.md

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
<!-- START doctoc -->
2-
<!-- END doctoc -->
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
3+
4+
- [News and Housekeeping](#news-and-housekeeping)
5+
- [Feedback and Q&A Forms](#feedback-and-qa-forms)
6+
- [Lecture 3 Follow-Up](#lecture-3-follow-up)
7+
- [Creating HTTP JSON API Routes](#creating-http-json-api-routes)
8+
- [The App Router](#the-app-router)
9+
- [Versioning](#versioning)
10+
- [New Example App](#new-example-app)
11+
- [Lecture 4 - Databases](#lecture-4---databases)
12+
- [Common Database Attributes](#common-database-attributes)
13+
- [Relational](#relational)
14+
- [Document](#document)
15+
- [Graph](#graph)
16+
- [Key / Value](#key--value)
17+
- [Blob](#blob)
18+
- [In-Memory](#in-memory)
19+
- [Flatfile](#flatfile)
20+
- [Database Type Resources](#database-type-resources)
21+
- [Migrations](#migrations)
22+
- [Demo: Adding mongoDB to our app](#demo-adding-mongodb-to-our-app)
23+
24+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
325

426
## News and Housekeeping
527

@@ -51,7 +73,7 @@ const AllowedFields = new Set(["title", "content", "likes"]);
5173
export default async function PostList(
5274
req: NextApiRequest,
5375
// Primary difference 1: We are returning a partial post list
54-
res: NextApiResponse<readonly Partial<Post>[]>
76+
res: NextApiResponse<readonly Partial<Post>[]>,
5577
): Promise<void> {
5678
// Same as last time; this is pretty generic, so probably can be extracted
5779
// into a utility function.
@@ -89,7 +111,7 @@ const AllowedFields = new Set(["title", "content", "likes"]);
89111

90112
export default async function PostDetail(
91113
req: NextApiRequest,
92-
res: NextApiResponse<Partial<Post>>
114+
res: NextApiResponse<Partial<Post>>,
93115
): Promise<void> {
94116
const filter = req.query.filter;
95117
const parts = typeof filter === "string" ? filter.split(",") : filter;
@@ -442,7 +464,7 @@ compose file is doing; creating and running an init script:
442464
```js
443465
db.getSiblingDB("admin").auth(
444466
process.env.MONGO_INITDB_ROOT_USERNAME,
445-
process.env.MONGO_INITDB_ROOT_PASSWORD
467+
process.env.MONGO_INITDB_ROOT_PASSWORD,
446468
);
447469
db.createUser({
448470
user: "app",
@@ -573,9 +595,9 @@ export const appRouter = router({
573595
const comments = await comment.find({ post: postId }).exec();
574596
// Add it to the returned object
575597
return { ...post, comments };
576-
})
598+
}),
577599
);
578-
}
600+
},
579601
),
580602
addPost: publicProcedure
581603
.input(z.object({ title: z.string(), content: z.string() }))
@@ -595,7 +617,7 @@ export const appRouter = router({
595617
postId: z.string(),
596618
content: z.string(),
597619
meta: z.any().optional(),
598-
})
620+
}),
599621
)
600622
.mutation(async (opts) => {
601623
const { postId, content, meta } = opts.input;

0 commit comments

Comments
 (0)