Skip to content

Commit d843039

Browse files
committed
add URL examples
1 parent 8f29a56 commit d843039

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/extend-express-app/keystone.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export default config<TypeInfo>({
2323
// this example HTTP GET handler retrieves any posts in the database for your context
2424
// with an optional request query parameter of `draft=1`
2525
// returning them as JSON
26+
//
27+
// e.g
28+
// http://localhost:3000/rest/posts
29+
// http://localhost:3000/rest/posts?draft=1
30+
//
2631
app.get('/rest/posts', async (req, res) => {
2732
const context = await commonContext.withRequest(req, res)
2833
// if (!context.session) return res.status(401).end()
@@ -46,6 +51,9 @@ export default config<TypeInfo>({
4651
},
4752

4853
extendHttpServer: (server, commonContext) => {
54+
// e.g
55+
// http://localhost:3000/rest/posts/clu7x6ch90002a89s6l63bjb5
56+
//
4957
server.on('request', async (req, res) => {
5058
if (!req.url?.startsWith('/rest/posts/')) return
5159

0 commit comments

Comments
 (0)