Skip to content

Commit

Permalink
Refactor/update packages (#50)
Browse files Browse the repository at this point in the history
* replaced xml2js and restify-cors-middleware

* updated nodemon
  • Loading branch information
reed-tom authored Sep 15, 2023
1 parent 4018149 commit b4e31f1
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 54 deletions.
68 changes: 68 additions & 0 deletions api-doc.json
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,74 @@
"deprecated": false
}
},
"/public/reports/embed/report": {
"get": {
"tags": [
"Public/Reports"
],
"summary": "Retrieve embed token",
"description": "",
"parameters": [],
"responses": {
"200": {
"description": "OK"
},
"500": {
"description": "Internal Server Error"
}
},
"deprecated": false
},
"post": {
"tags": [
"Public/Reports"
],
"summary": "Set embedded parameters",
"description": "",
"parameters": [
{
"name": "obj",
"in": "body",
"description": "Report Parameters",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "name"
},
"value": {
"type": "string",
"example": "value"
},
"type": {
"type": "string",
"example": "type"
}
},
"required": [
"name",
"value",
"type"
]
}
}
}
],
"responses": {
"200": {
"description": "OK"
},
"500": {
"description": "Internal Server Error"
}
},
"deprecated": false
}
},
"/public/reports/mls/image/{mls}/{overview}/{width}/{height}": {
"get": {
"tags": [
Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var config = require("./config");
const pathToSwaggerUi = require("swagger-ui-dist").absolutePath();
const fs = require("fs");
const packageJson = require("./package.json");
var corsMiddleware = require("restify-cors-middleware");
var corsMiddleware = require("restify-cors-middleware2");
const documentationOutputFile = require("path").join(__dirname, "./api-doc.json");

// CORS FOR RESTIFY
Expand Down
17 changes: 11 additions & 6 deletions helpers/weather.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
const sqlServer = require("./sqlServer");
const common = require("./common");
const fetch = require("node-fetch");
var xml2js = require("xml2js");
var parser = new xml2js.Parser();
const { XMLParser } = require("fast-xml-parser");
const options = {
ignoreAttributes: false, // Ignore the XML attributes
numberParseOptions: {
leadingZeros: false,
},
attributeNamePrefix: "", // Default is an underscore. Set to null to disable it
attributesGroupName: "$", // XML node attributes group name prefix
};
const parser = new XMLParser(options);

module.exports = {
getRadarImages: function (fromDate, toDate, callback) {
Expand Down Expand Up @@ -39,9 +46,7 @@ module.exports = {
return response.text();
})
.then((responseText) => {
parser.parseString(responseText, function (err, result) {
callback(result);
});
callback(parser.parse(responseText));
})
.catch((error) => {
console.error(error);
Expand Down
123 changes: 80 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
"doc-gen": "node swagger.js"
},
"devDependencies": {
"nodemon": "^2.0.22"
"nodemon": "^3.0.1"
},
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.10",
"@mapbox/polyline": "^1.2.0",
"canvas": "^2.11.0",
"cors": "^2.8.5",
"dotenv": "^16.1.4",
"fast-xml-parser": "^4.2.7",
"geojson": "^0.5.0",
"got": "^11.8.6",
"moment": "^2.29.4",
Expand All @@ -31,9 +32,8 @@
"nodemailer": "^6.9.1",
"pg": "^8.10.0",
"restify": "^11.1.0",
"restify-cors-middleware": "^1.1.1",
"restify-cors-middleware2": "^2.2.1",
"swagger-autogen": "^2.23.1",
"swagger-ui-dist": "^4.18.2",
"xml2js": "^0.5.0"
"swagger-ui-dist": "^4.18.2"
}
}

0 comments on commit b4e31f1

Please sign in to comment.