@@ -5,6 +5,11 @@ const log = require('loglevel')
55const errorResourceNotFoundResponse = require ( './responses/error-resource-not-found.json' )
66const errorSandboxResponseNotFound = require ( './responses/error-sandbox-response-not-found.json' )
77
8+ // Manifest pages - Responses
9+ const manifestPagesRootNoParamsResponse = require ( './responses/manifest-pages-root-no-params.json' )
10+ const manifestPagesRootPage1Response = require ( './responses/manifest-pages-root-page-1.json' )
11+ const manifestPagesRootPage2Response = require ( './responses/manifest-pages-root-page-2.json' )
12+
813// Conditions - Responses
914const conditionsRootNoParamsResponse = require ( './responses/conditions-root-no-params.json' )
1015const conditionsAcanthosisNigricansResponse = require ( './responses/conditions-acanthosis-nigricans-no-params.json' )
@@ -100,6 +105,45 @@ async function root(req, res, next) {
100105 next ( )
101106}
102107
108+ // ******************************************************************
109+ // ** Manifest pages
110+ // ******************************************************************
111+
112+ // Live website URL
113+ // https://www.nhs.uk/manifest/pages/
114+ // This sandbox on localhost
115+ // http://localhost:9000/manifest/pages/
116+ // API on Azure API Management
117+ // https://api.nhs.uk/manifest/pages/
118+ // Wagtail (Python) Application (no auth key required)
119+ // https://www.nhs.uk/content-api/manifest/pages/
120+ // Apigee Sandbox environment (no auth key required)
121+ // https://sandbox.api.service.nhs.uk/nhs-website-content/manifest/pages/
122+ // Apigee Integration environment ('apikey' required in Header)
123+ // https://int.api.service.nhs.uk/nhs-website-content/manifest/pages/
124+ // Apigee Production environment ('apikey' required in Header)
125+ // https://api.service.nhs.uk/nhs-website-content/manifest/pages/
126+ async function manifestPagesRoot ( req , res , next ) {
127+ let responseJson
128+ if ( req . query . page ) {
129+ if ( req . query . page === '1' ) {
130+ // http://localhost:9000/manifest/pages/?page=1
131+ responseJson = manifestPagesRootPage1Response
132+ } else if ( req . query . page === '2' ) {
133+ // http://localhost:9000/manifest/pages/?page=2
134+ responseJson = manifestPagesRootPage2Response
135+ } else {
136+ responseJson = errorSandboxResponseNotFound
137+ }
138+ } else {
139+ responseJson = manifestPagesRootNoParamsResponse
140+ }
141+ res . status ( 200 ) . json ( responseJson )
142+
143+ res . end ( )
144+ next ( )
145+ }
146+
103147// ******************************************************************
104148// ** Conditions pages
105149// ******************************************************************
@@ -1012,6 +1056,7 @@ async function status(req, res, next) {
10121056
10131057module . exports = {
10141058 root,
1059+ manifestPagesRoot,
10151060 conditionsAcanthosisNigricans,
10161061 conditionsAchalasia,
10171062 conditionsAcne,
0 commit comments