Skip to content

Commit d406942

Browse files
authored
SYN-866: Add the '/vaccinations' and '/contraception' paths to the NHS Website Content API v2 (#135)
* Added search and replace Regex for ‘vaccinations’ and ‘contraception’ * Updated list at top of page * Added 4 example JSON responses * Update spec file to include ‘Contraception’ and ‘Vaccinations’ * Updated the Postman collection * Increased number of sandbox endpoints to include ‘Contraception’ and ‘Vaccinations’ * Updated Sandbox endpoints list * Added protocols and hostnames to broken href attributes * Fixed href hostnames to ‘https://www.nhs.uk/' * Text change in spec file * Text change in the spec file RE: Onboarding approval
1 parent 19fd6af commit d406942

36 files changed

Lines changed: 5281 additions & 814 deletions

File tree

proxies/live/apiproxy/resources/jsc/SearchAndReplaceResponse.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -226,34 +226,6 @@ var searchAndReplaceStrings = [
226226
searchForRegex: /href=\\"\/common-health-questions\//gm,
227227
replaceWithStr: 'href=\\"https://www.nhs.uk/common-health-questions/',
228228
},
229-
{
230-
comment1: "=============================================================",
231-
comment2: "Vaccinations ",
232-
comment3: "=============================================================",
233-
},
234-
{
235-
searchForRegex: /:\s?"https:\/\/api.nhs.uk\/vaccinations\//gm,
236-
replaceWithStr:
237-
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
238-
},
239-
{
240-
searchForRegex: /:\s?"https:\/\/www.nhs.uk\/vaccinations\//gm,
241-
replaceWithStr:
242-
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
243-
},
244-
{
245-
searchForRegex: /:\s?"\/vaccinations\//gm,
246-
replaceWithStr:
247-
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
248-
},
249-
{
250-
searchForRegex: /href=\\"https:\/\/api.nhs.uk\/vaccinations\//gm,
251-
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
252-
},
253-
{
254-
searchForRegex: /href=\\"\/vaccinations\//gm,
255-
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
256-
},
257229
{
258230
comment1: "=============================================================",
259231
comment2: "Contraception ",
@@ -288,6 +260,34 @@ var searchAndReplaceStrings = [
288260
searchForRegex: /href=\\"\/contraception\//gm,
289261
replaceWithStr: 'href=\\"https://www.nhs.uk/contraception/',
290262
},
263+
{
264+
comment1: "=============================================================",
265+
comment2: "Vaccinations ",
266+
comment3: "=============================================================",
267+
},
268+
{
269+
searchForRegex: /:\s?"https:\/\/api.nhs.uk\/vaccinations\//gm,
270+
replaceWithStr:
271+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
272+
},
273+
{
274+
searchForRegex: /:\s?"https:\/\/www.nhs.uk\/vaccinations\//gm,
275+
replaceWithStr:
276+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
277+
},
278+
{
279+
searchForRegex: /:\s?"\/vaccinations\//gm,
280+
replaceWithStr:
281+
': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
282+
},
283+
{
284+
searchForRegex: /href=\\"https:\/\/api.nhs.uk\/vaccinations\//gm,
285+
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
286+
},
287+
{
288+
searchForRegex: /href=\\"\/vaccinations\//gm,
289+
replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
290+
},
291291
];
292292

293293
var responseContent = context.getVariable("response.content");

proxies/sandbox/apiproxy/resources/jsc/SearchAndReplaceResponse.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,68 @@
170170
// searchForRegex: /href=\\"\/common-health-questions\//gm,
171171
// replaceWithStr: 'href=\\"https://www.nhs.uk/common-health-questions/',
172172
// },
173+
// {
174+
// comment1: "=============================================================",
175+
// comment2: "Contraception ",
176+
// comment3: "=============================================================",
177+
// },
178+
// {
179+
// searchForRegex: /:\s?"https:\/\/api.nhs.uk\/contraception\//gm,
180+
// replaceWithStr:
181+
// ': "https://' +
182+
// requestHostnameEnv +
183+
// "/nhs-website-content/contraception/",
184+
// },
185+
// {
186+
// searchForRegex: /:\s?"https:\/\/www.nhs.uk\/contraception\//gm,
187+
// replaceWithStr:
188+
// ': "https://' +
189+
// requestHostnameEnv +
190+
// "/nhs-website-content/contraception/",
191+
// },
192+
// {
193+
// searchForRegex: /:\s?"\/contraception\//gm,
194+
// replaceWithStr:
195+
// ': "https://' +
196+
// requestHostnameEnv +
197+
// "/nhs-website-content/contraception/",
198+
// },
199+
// {
200+
// searchForRegex: /href=\\"https:\/\/api.nhs.uk\/contraception\//gm,
201+
// replaceWithStr: 'href=\\"https://www.nhs.uk/contraception/',
202+
// },
203+
// {
204+
// searchForRegex: /href=\\"\/contraception\//gm,
205+
// replaceWithStr: 'href=\\"https://www.nhs.uk/contraception/',
206+
// },
207+
// {
208+
// comment1: "=============================================================",
209+
// comment2: "Vaccinations ",
210+
// comment3: "=============================================================",
211+
// },
212+
// {
213+
// searchForRegex: /:\s?"https:\/\/api.nhs.uk\/vaccinations\//gm,
214+
// replaceWithStr:
215+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
216+
// },
217+
// {
218+
// searchForRegex: /:\s?"https:\/\/www.nhs.uk\/vaccinations\//gm,
219+
// replaceWithStr:
220+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
221+
// },
222+
// {
223+
// searchForRegex: /:\s?"\/vaccinations\//gm,
224+
// replaceWithStr:
225+
// ': "https://' + requestHostnameEnv + "/nhs-website-content/vaccinations/",
226+
// },
227+
// {
228+
// searchForRegex: /href=\\"https:\/\/api.nhs.uk\/vaccinations\//gm,
229+
// replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
230+
// },
231+
// {
232+
// searchForRegex: /href=\\"\/vaccinations\//gm,
233+
// replaceWithStr: 'href=\\"https://www.nhs.uk/vaccinations/',
234+
// },
173235
// ];
174236

175237
var responseContent = context.getVariable("response.content");

sandbox/Sandbox endpoints - localhost.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22

33
## API Root
44

5-
[API Root - Without](http://localhost:9000/)
6-
7-
[API Root - With example](http://localhost:9000/)
5+
[API Root](http://localhost:9000/)
86

97
## Common Health Questions
108

11-
[Common Health Questions Root - Without](http://localhost:9000/common-health-questions/)
12-
13-
[Common Health Questions Root - With example](http://localhost:9000/common-health-questions/)
9+
[Common Health Questions Root](http://localhost:9000/common-health-questions/)
1410

1511
[Accidents, first aid and treatments](http://localhost:9000/common-health-questions/accidents-first-aid-and-treatments/)
1612

@@ -20,9 +16,7 @@
2016

2117
## Conditions
2218

23-
[Conditions Root - Without](http://localhost:9000/conditions/)
24-
25-
[Conditions Root - With example](http://localhost:9000/conditions/)
19+
[Conditions Root](http://localhost:9000/conditions/)
2620

2721
[Conditions Root - Category: A](http://localhost:9000/conditions/?category=a)
2822

@@ -62,9 +56,7 @@
6256

6357
## Live Well
6458

65-
[Live Well Root - Without](http://localhost:9000/live-well/)
66-
67-
[Live Well Root - With example](http://localhost:9000/live-well/)
59+
[Live Well Root](http://localhost:9000/live-well/)
6860

6961
[Alcohol advice - Alcohol support](http://localhost:9000/live-well/alcohol-advice/alcohol-support/)
7062

@@ -74,9 +66,7 @@
7466

7567
## Medicines
7668

77-
[Medicines Root - Without](http://localhost:9000/medicines/)
78-
79-
[Medicines Root - With example](http://localhost:9000/medicines/)
69+
[Medicines Root](http://localhost:9000/medicines/)
8070

8171
[Medicines Root - Category: A](http://localhost:9000/medicines/?category=a)
8272

@@ -102,9 +92,7 @@
10292

10393
## Mental Health
10494

105-
[Mental Health Root - Without](http://localhost:9000/mental-health/)
106-
107-
[Mental Health Root - With example](http://localhost:9000/mental-health/)
95+
[Mental Health Root](http://localhost:9000/mental-health/)
10896

10997
[Advice for life situations and events - Bullying at work](http://localhost:9000/mental-health/advice-for-life-situations-and-events/support-for-workplace-bullying/)
11098

@@ -114,9 +102,7 @@
114102

115103
## NHS Services
116104

117-
[NHS Services Root - Without](http://localhost:9000/nhs-services/)
118-
119-
[NHS Services Root - With example](http://localhost:9000/nhs-services/)
105+
[NHS Services Root](http://localhost:9000/nhs-services/)
120106

121107
[GPs](http://localhost:9000/nhs-services/gps/)
122108

@@ -126,12 +112,30 @@
126112

127113
## Pregnancy
128114

129-
[Pregnancy Root - Without](http://localhost:9000/pregnancy/)
130-
131-
[Pregnancy Root - With example](http://localhost:9000/pregnancy/)
115+
[Pregnancy Root](http://localhost:9000/pregnancy/)
132116

133117
[Finding out you're pregnant - Finding out you're pregnant](http://localhost:9000/pregnancy/finding-out/finding-out-you-are-pregnant/)
134118

135119
[Having a baby if you're LGBT+](http://localhost:9000/pregnancy/having-a-baby-if-you-are-lgbt-plus/)
136120

137121
[Trying for a baby](http://localhost:9000/pregnancy/trying-for-a-baby/)
122+
123+
## Contraception
124+
125+
[Contraception Root](http://localhost:9000/contraception/)
126+
127+
[Methods of contraception](http://localhost:9000/contraception/methods-of-contraception/)
128+
129+
[What is the combined pill?](http://localhost:9000/contraception/methods-of-contraception/combined-pill/what-is-it/)
130+
131+
[Condoms](http://localhost:9000/contraception/methods-of-contraception/condoms/)
132+
133+
## Vaccinations
134+
135+
[Vaccinations Root](http://localhost:9000/vaccinations/)
136+
137+
[NHS vaccinations and when to have them](http://localhost:9000/vaccinations/nhs-vaccinations-and-when-to-have-them/)
138+
139+
[6-in-1 vaccine](http://localhost:9000/vaccinations/6-in-1-vaccine/)
140+
141+
[Available travel vaccines](http://localhost:9000/vaccinations/travel-vaccinations/available-travel-vaccines/)

sandbox/app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,22 @@ app.all('/pregnancy/finding-out/finding-out-you-are-pregnant/', handlers.pregnan
204204
app.all('/pregnancy/having-a-baby-if-you-are-lgbt-plus/', handlers.pregnancyHavingABabyIfYouAreLgbtPlus)
205205
app.all('/pregnancy/trying-for-a-baby/', handlers.pregnancyTryingForABaby)
206206

207+
// ******************************************************************
208+
// ** Contraception pages
209+
// ******************************************************************
210+
app.all('/contraception/', handlers.contraceptionRoot)
211+
app.all('/contraception/methods-of-contraception/', handlers.contraceptionMethodsOfContraception)
212+
app.all('/contraception/methods-of-contraception/combined-pill/what-is-it/', handlers.contraceptionWhatIsTheCombinedPill)
213+
app.all('/contraception/methods-of-contraception/condoms/', handlers.contraceptionCondoms)
214+
215+
// ******************************************************************
216+
// ** Vaccinations pages
217+
// ******************************************************************
218+
app.all('/vaccinations/', handlers.vaccinationsRoot)
219+
app.all('/vaccinations/nhs-vaccinations-and-when-to-have-them/', handlers.vaccinationsNhsVaccinationsAndWhenToHaveThem)
220+
app.all('/vaccinations/6-in-1-vaccine/', handlers.vaccinations6in1Vaccine)
221+
app.all('/vaccinations/travel-vaccinations/available-travel-vaccines/', handlers.vaccinationsAvailableTravelVaccines)
222+
207223
app.use((req, res, next) => {
208224
res.status(404).json(errorResourceNotFoundResponse)
209225
})

0 commit comments

Comments
 (0)