Skip to content

Commit cb1831b

Browse files
committed
Amend call to formatter
1 parent a7ea652 commit cb1831b

6 files changed

Lines changed: 27 additions & 21 deletions

File tree

context-provider/controllers/proxy/catfacts-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function getAsNGSIv2(req, res) {
101101
//
102102
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
103103
//
104-
function getAsNgsiLD(req, res, asArray = false) {
104+
function getAsNgsiLD(req, res, next, asArray = false) {
105105
monitor('/ngsi-ld/v1/entities', 'Data requested from Cat Facts API', req.body);
106106
makeCatFactsRequest()
107107
.then((result) => {

context-provider/controllers/proxy/openweathermap-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function getAsNGSIv2(req, res) {
101101
//
102102
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
103103
//
104-
function getAsNgsiLD(req, res, asArray = false) {
104+
function getAsNgsiLD(req, res, next, asArray = false) {
105105
monitor('/ngsi-ld/v1/entities', 'Data requested from OpenWeatherMap API', req.body);
106106
makeWeatherRequest(req.params.queryString)
107107
.then((result) => {

context-provider/controllers/proxy/random-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function getAsNGSIv2(req, res) {
6161
//
6262
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
6363
//
64-
function getAsNgsiLD(req, res, asArray = false) {
64+
function getAsNgsiLD(req, res, next, asArray = false) {
6565
monitor('/ngsi-ld/v1/entities', 'Data requested from Random API', req.body);
6666
res.set('Content-Type', 'application/ld+json');
6767
const response = Formatter.formatAsLDResponse(req, null, (name, type) => {

context-provider/controllers/proxy/static-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function getAsNGSIv2(req, res) {
7878
//
7979
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
8080
//
81-
function getAsNgsiLD(req, res, asArray = false) {
81+
function getAsNgsiLD(req, res, next, asArray = false) {
8282
const response = Formatter.formatAsLDResponse(req, null, (name, type) => {
8383
return staticValues[type.toLowerCase()];
8484
});

context-provider/controllers/proxy/twitter-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function getAsNGSIv2(req, res) {
111111
//
112112
// The /ngsi-ld/v1/entities/:id endpoint responds with data in the NGSI-LD format
113113
//
114-
function getAsNgsiLD(req, res, asArray = false) {
114+
function getAsNgsiLD(req, res, next, asArray = false) {
115115
monitor('/ngsi-ld/v1/entities', 'Data requested from Twitter API', req.body);
116116

117117
makeTwitterRequest(

context-provider/routes/proxy-ld.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,6 @@ function noOp(req, res) {
6969
res.send();
7070
}
7171

72-
73-
router.get('/catfacts/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
74-
req.params.id = req.query.id || '12345'
75-
CatFactsNGSIProxy.getAsNgsiLD(req, res, true);
76-
});
77-
router.get('/random/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
78-
req.params.id = req.query.id || '12345'
79-
RandomNGSIProxy.getAsNgsiLD(req, res, true);
80-
});
81-
router.get('/static/tweets/ngsi-ld/v1/entities', tweetDefaults, (req, res) => {
82-
req.params.id = req.query.id || '12345'
83-
StaticNGSIProxy.getAsNgsiLD(req, res, true);
84-
});
85-
86-
87-
8872
router.get('/catfacts/:type/:mapping/ngsi-ld/v1/entities/:id', CatFactsNGSIProxy.getAsNgsiLD);
8973
router.get('/random/:type/:mapping/ngsi-ld/v1/entities/:id', RandomNGSIProxy.getAsNgsiLD);
9074
router.get('/static/:type/:mapping/ngsi-ld/v1/entities/:id', StaticNGSIProxy.getAsNgsiLD);
@@ -143,6 +127,23 @@ router.get('/static/weatherConditions/ngsi-ld/v1/entities/:id', weatherDefaults,
143127
router.get('/weather/weatherConditions/ngsi-ld/v1/entities/:id', weatherDefaults, WeatherNGSIProxy.getAsNgsiLD);
144128

145129
// Convenience endpoints for tweets readings
130+
131+
132+
133+
router.get('/catfacts/tweets/ngsi-ld/v1/entities/', tweetDefaults, (req, res, next) => {
134+
req.params.id = req.query.id || '12345'
135+
CatFactsNGSIProxy.getAsNgsiLD(req, res, next, true);
136+
});
137+
router.get('/random/tweets/ngsi-ld/v1/entities/', tweetDefaults, (req, res, next) => {
138+
req.params.id = req.query.id || '12345'
139+
RandomNGSIProxy.getAsNgsiLD(req, res, next, true);
140+
});
141+
router.get('/static/tweets/ngsi-ld/v1/entities/', tweetDefaults, (req, res, next) => {
142+
req.params.id = req.query.id || '12345'
143+
StaticNGSIProxy.getAsNgsiLD(req, res, next, true);
144+
});
145+
146+
146147
router.get('/random/tweets/ngsi-ld/v1/entities/:id', tweetDefaults, RandomNGSIProxy.getAsNgsiLD);
147148

148149
router.get('/static/tweets/ngsi-ld/v1/entities/:id', tweetDefaults, StaticNGSIProxy.getAsNgsiLD);
@@ -151,6 +152,11 @@ router.get('/twitter/tweets/ngsi-ld/v1/entities/:id', tweetDefaults, TwitterNGSI
151152

152153
router.get('/catfacts/tweets/ngsi-ld/v1/entities/:id', tweetDefaults, CatFactsNGSIProxy.getAsNgsiLD);
153154

155+
156+
157+
158+
159+
154160
// Not Supported Endpoints
155161

156162
router.all('/:proxy/:attributes/ngsi-ld/v1/entities', notSupported);

0 commit comments

Comments
 (0)