Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Apr 3, 2024
1 parent e2969f6 commit 1bb201b
Show file tree
Hide file tree
Showing 469 changed files with 11,858 additions and 287 deletions.
4 changes: 2 additions & 2 deletions exercises/01.init/01.problem.static/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ app.use((req, res, next) => {

// 🐨 add an API endpoint to get data for our page:
// 💰
// app.get('/api/:shipId?', async function (req, res) {
// app.get('/api/:shipId?', async (req, res) => {
// try {
// const shipId = req.params.shipId || null
// const search = req.query.search || ''
Expand All @@ -50,7 +50,7 @@ app.use((req, res, next) => {
// 🐨 add a handler for '/:shipId?' which means the ship is optional
// 🐨 set the response Content-type to 'text/html' and send the file in public called index.html
// 💰
// app.get('/:shipId?', async function (req, res) {
// app.get('/:shipId?', async (req, res) => {
// res.set('Content-type', 'text/html')
// return res.sendFile('index.html', { root: 'public' })
// })
Expand Down
4 changes: 2 additions & 2 deletions exercises/01.init/01.solution.static/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ app.use((req, res, next) => {
}
})

app.get('/api/:shipId?', async function (req, res) {
app.get('/api/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -42,7 +42,7 @@ app.get('/api/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/02.server-components/01.problem.rsc/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ app.use((req, res, next) => {
})

// 🐨 change this from /api to /rsc
app.get('/api/:shipId?', async function (req, res) {
app.get('/api/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -58,7 +58,7 @@ app.get('/api/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/02.server-components/01.solution.rsc/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -46,7 +46,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -48,7 +48,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -42,7 +42,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -42,7 +42,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -42,7 +42,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -46,7 +46,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -46,7 +46,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -46,7 +46,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -48,7 +48,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 4 additions & 0 deletions exercises/03.client-components/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,7 @@ createFromFetch(fetchPromise, {
Then when `react-server-dom-esm/client` needs to load a module, it will fetch
the module from `${window.location.origin}/js/src/ship-search.js` and `import`
the `ShipSearch` `export` from it.
📜 Relevant Docs:
- [`use-client`](https://react.dev/reference/react/use-client)
4 changes: 2 additions & 2 deletions exercises/04.router/01.problem.router/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/01.solution.router/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/02.problem.pending-ui/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/02.solution.pending-ui/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/03.problem.race-conditions/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ app.get('/rsc/:shipId?', async function (req, res, next) {
next()
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -59,7 +59,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/03.solution.race-conditions/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ app.get('/rsc/:shipId?', async function (req, res, next) {
next()
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -59,7 +59,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
4 changes: 2 additions & 2 deletions exercises/04.router/04.problem.history/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.use((req, res, next) => {
}
})

app.get('/rsc/:shipId?', async function (req, res) {
app.get('/rsc/:shipId?', async (req, res) => {
try {
const shipId = req.params.shipId || null
const search = req.query.search || ''
Expand All @@ -47,7 +47,7 @@ app.get('/rsc/:shipId?', async function (req, res) {
}
})

app.get('/:shipId?', async function (req, res) {
app.get('/:shipId?', async (req, res) => {
res.set('Content-type', 'text/html')
return res.sendFile('index.html', { root: 'public' })
})
Expand Down
Loading

0 comments on commit 1bb201b

Please sign in to comment.