@@ -19,14 +19,13 @@ const conditionsAcneModulesTrueResponse = require('./responses/conditions-acne-m
1919const conditionsAngiographyResponse = require ( './responses/conditions-angiography-no-params.json' )
2020const conditionsCancerResponse = require ( './responses/conditions-cancer-no-params.json' )
2121const conditionsRootCategoryAGenreConditionResponse = require ( './responses/conditions-root-category-a-genre-condition.json' )
22- const conditionsRootCategoryAGenreGuideResponse = require ( './responses/conditions-root-category-a-genre-guide.json' )
2322const conditionsRootCategoryAGenreHubResponse = require ( './responses/conditions-root-category-a-genre-hub.json' )
2423const conditionsRootCategoryAResponse = require ( './responses/conditions-root-category-a.json' )
2524const conditionsRootCategoryBResponse = require ( './responses/conditions-root-category-b.json' )
2625const conditionsRootCategoryZResponse = require ( './responses/conditions-root-category-z.json' )
2726const conditionsRootPage1Response = require ( './responses/conditions-root-page-1.json' )
2827const conditionsRootPage2Response = require ( './responses/conditions-root-page-2.json' )
29- const conditionsRootPage70Response = require ( './responses/conditions-root-page-70 .json' )
28+ const conditionsRootPage29Response = require ( './responses/conditions-root-page-29 .json' )
3029const conditionsWildcardResponseNoParams = require ( './responses/conditions-acne-no-params.json' )
3130const conditionsWildcardModulesTrueResponse = require ( './responses/conditions-acne-modules-true.json' )
3231const conditionsZikaResponse = require ( './responses/conditions-zika-no-params.json' )
@@ -86,6 +85,20 @@ const womensHealthRootResponse = require('./responses/womens-health-root-no-para
8685const womensHealthPeriodsResponse = require ( './responses/womens-health-periods-no-params.json' )
8786const womensHealthAnaemiaResponse = require ( './responses/womens-health-anaemia-no-params.json' )
8887
88+ // Symptoms - Responses
89+ const symptomsRootNoParamsResponse = require ( './responses/symptoms-root-no-params.json' )
90+ const symptomsRootCategoryAResponse = require ( './responses/symptoms-root-category-a.json' )
91+ const symptomsRootCategoryBResponse = require ( './responses/symptoms-root-category-b.json' )
92+ const symptomsRootPage1Response = require ( './responses/symptoms-root-page-1.json' )
93+ const symptomsRootPage6Response = require ( './responses/symptoms-root-page-6.json' )
94+
95+ // Tests and treatments - Responses
96+ const testsAndTreatmentsRootNoParamsResponse = require ( './responses/tests-and-treatments-root-no-params.json' )
97+ const testsAndTreatmentsRootCategoryAResponse = require ( './responses/tests-and-treatments-root-category-a.json' )
98+ const testsAndTreatmentsRootCategoryBResponse = require ( './responses/tests-and-treatments-root-category-b.json' )
99+ const testsAndTreatmentsRootPage1Response = require ( './responses/tests-and-treatments-root-page-1.json' )
100+ const testsAndTreatmentsRootPage7Response = require ( './responses/tests-and-treatments-root-page-7.json' )
101+
89102// ******************************************************************
90103// ** Root page
91104// ******************************************************************
@@ -173,9 +186,6 @@ async function conditionsRoot(req, res, next) {
173186 if ( req . query . category . toLowerCase ( ) === 'a' && req . query . genre . toLowerCase ( ) === 'condition' ) {
174187 // http://localhost:9000/conditions/?category=a&genre=condition
175188 responseJson = conditionsRootCategoryAGenreConditionResponse
176- } else if ( req . query . category . toLowerCase ( ) === 'a' && req . query . genre . toLowerCase ( ) === 'guide' ) {
177- // http://localhost:9000/conditions/?category=a&genre=guide
178- responseJson = conditionsRootCategoryAGenreGuideResponse
179189 } else if ( req . query . category . toLowerCase ( ) === 'a' && req . query . genre . toLowerCase ( ) === 'hub' ) {
180190 // http://localhost:9000/conditions/?category=a&genre=hub
181191 responseJson = conditionsRootCategoryAGenreHubResponse
@@ -202,9 +212,9 @@ async function conditionsRoot(req, res, next) {
202212 } else if ( req . query . page === '2' ) {
203213 // http://localhost:9000/conditions/?page=2
204214 responseJson = conditionsRootPage2Response
205- } else if ( req . query . page === '70 ' ) {
206- // http://localhost:9000/conditions/?page=70
207- responseJson = conditionsRootPage70Response
215+ } else if ( req . query . page === '29 ' ) {
216+ // http://localhost:9000/conditions/?page=29
217+ responseJson = conditionsRootPage29Response
208218 } else {
209219 responseJson = errorSandboxResponseNotFound
210220 }
@@ -1108,6 +1118,106 @@ async function womensHealthAnaemia(req, res, next) {
11081118 next ( )
11091119}
11101120
1121+ // ******************************************************************
1122+ // ** Symptoms pages
1123+ // ******************************************************************
1124+
1125+ // Live website URL
1126+ // https://www.nhs.uk/symptoms/
1127+ // This sandbox on localhost
1128+ // http://localhost:9000/symptoms/
1129+ // API on Azure API Management
1130+ // https://api.nhs.uk/symptoms/
1131+ // Wagtail (Python) Application (no auth key required)
1132+ // https://www.nhs.uk/content-api/symptoms/
1133+ // Apigee Sandbox environment (no auth key required)
1134+ // https://sandbox.api.service.nhs.uk/nhs-website-content/symptoms/
1135+ // Apigee Integration environment ('apikey' required in Header)
1136+ // https://int.api.service.nhs.uk/nhs-website-content/symptoms/
1137+ // Apigee Production environment ('apikey' required in Header)
1138+ // https://api.service.nhs.uk/nhs-website-content/symptoms/
1139+ async function symptomsRoot ( req , res , next ) {
1140+ let responseJson
1141+ if ( req . query . category ) {
1142+ if ( req . query . category . toLowerCase ( ) === 'a' ) {
1143+ // http://localhost:9000/symptoms/?category=a
1144+ responseJson = symptomsRootCategoryAResponse
1145+ } else if ( req . query . category . toLowerCase ( ) === 'b' ) {
1146+ // http://localhost:9000/symptoms/?category=b
1147+ responseJson = symptomsRootCategoryBResponse
1148+ } else {
1149+ responseJson = errorSandboxResponseNotFound
1150+ }
1151+ } else if ( req . query . page ) {
1152+ if ( req . query . page === '1' ) {
1153+ // http://localhost:9000/symptoms/?page=1
1154+ responseJson = symptomsRootPage1Response
1155+ } else if ( req . query . page === '6' ) {
1156+ // http://localhost:9000/symptoms/?page=6
1157+ responseJson = symptomsRootPage6Response
1158+ } else {
1159+ responseJson = errorSandboxResponseNotFound
1160+ }
1161+ } else {
1162+ // http://localhost:9000/symptoms/
1163+ responseJson = symptomsRootNoParamsResponse
1164+ }
1165+ res . status ( 200 ) . json ( responseJson )
1166+
1167+ res . end ( )
1168+ next ( )
1169+ }
1170+
1171+ // ******************************************************************
1172+ // ** Tests and treatment pages
1173+ // ******************************************************************
1174+
1175+ // Live website URL
1176+ // https://www.nhs.uk/tests-and-treatments/
1177+ // This sandbox on localhost
1178+ // http://localhost:9000/tests-and-treatments/
1179+ // API on Azure API Management
1180+ // https://api.nhs.uk/tests-and-treatments/
1181+ // Wagtail (Python) Application (no auth key required)
1182+ // https://www.nhs.uk/content-api/tests-and-treatments/
1183+ // Apigee Sandbox environment (no auth key required)
1184+ // https://sandbox.api.service.nhs.uk/nhs-website-content/tests-and-treatments/
1185+ // Apigee Integration environment ('apikey' required in Header)
1186+ // https://int.api.service.nhs.uk/nhs-website-content/tests-and-treatments/
1187+ // Apigee Production environment ('apikey' required in Header)
1188+ // https://api.service.nhs.uk/nhs-website-content/tests-and-treatments/
1189+ async function testsAndTreatmentsRoot ( req , res , next ) {
1190+ let responseJson
1191+ if ( req . query . category ) {
1192+ if ( req . query . category . toLowerCase ( ) === 'a' ) {
1193+ // http://localhost:9000/tests-and-treatments/?category=a
1194+ responseJson = testsAndTreatmentsRootCategoryAResponse
1195+ } else if ( req . query . category . toLowerCase ( ) === 'b' ) {
1196+ // http://localhost:9000/tests-and-treatments/?category=b
1197+ responseJson = testsAndTreatmentsRootCategoryBResponse
1198+ } else {
1199+ responseJson = errorSandboxResponseNotFound
1200+ }
1201+ } else if ( req . query . page ) {
1202+ if ( req . query . page === '1' ) {
1203+ // http://localhost:9000/tests-and-treatments/?page=1
1204+ responseJson = testsAndTreatmentsRootPage1Response
1205+ } else if ( req . query . page === '7' ) {
1206+ // http://localhost:9000/tests-and-treatments/?page=7
1207+ responseJson = testsAndTreatmentsRootPage7Response
1208+ } else {
1209+ responseJson = errorSandboxResponseNotFound
1210+ }
1211+ } else {
1212+ // http://localhost:9000/tests-and-treatments/
1213+ responseJson = testsAndTreatmentsRootNoParamsResponse
1214+ }
1215+ res . status ( 200 ) . json ( responseJson )
1216+
1217+ res . end ( )
1218+ next ( )
1219+ }
1220+
11111221// ******************************************************************
11121222// ** Status
11131223// ******************************************************************
@@ -1167,4 +1277,6 @@ module.exports = {
11671277 womensHealthAnaemia,
11681278 womensHealthPeriods,
11691279 womensHealthRoot,
1280+ symptomsRoot,
1281+ testsAndTreatmentsRoot,
11701282}
0 commit comments