From 4e61b756d427480877abb53c7c5df3233518f7da Mon Sep 17 00:00:00 2001 From: Philip Harrison Date: Tue, 27 Jul 2021 18:56:39 +0100 Subject: [PATCH] Add more comments --- __tests__/server/server.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/__tests__/server/server.js b/__tests__/server/server.js index d60921b..678166d 100755 --- a/__tests__/server/server.js +++ b/__tests__/server/server.js @@ -10,10 +10,19 @@ const SERVER_PORT = process.argv.slice(2)[0] || 9000 // Sets up a fake dependabot-api using json-server // // Test it locally by running this script directly: -// $ node __tests__/server/server.js -// Running on http://localhost:9000 +// +// $ node __tests__/server/server.js Running on http://localhost:9000 // // Verify it works: curl http://localhost:9000/update_jobs/1/details +// +// The 'id' attribute is significant for json-server and maps requests tp the +// 'id' key in the db.json for the resource, for example: +// +// - GET /update_jobs/1/details and GET /update_jobs/1 return hard-coded update +// job in db.json +// - GET /update_jobs/2 would 404 +// - POST /update_jobs {data: {...attrs}} would persist a new update job with id +// 2 // NOTE: Serialise the response like dependabot-api router.render = (_, res) => {