Skip to content

Commit

Permalink
Add additional replace for info and error returns
Browse files Browse the repository at this point in the history
Allows v2 to be deployed from root
  • Loading branch information
CannonLock committed Oct 13, 2023
1 parent 1974757 commit e4f54bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions v2/larkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ var mysql = require("mysql"),


larkin.info = function(req, res, next) {
var formatted = (req.baseUrl + req.route.path).replace("/api/v" + api.version, "").replace("/api", "").replace(/\/$/, "");
var formatted = (req.baseUrl + req.route.path)
.replace("/api/v" + api.version, "")
.replace("/api", "")
.replace(/\/$/, "")
.replace("/v" + api.version, "");
this.defineRoute(formatted, function(definition) {
res.json({
"success": definition
Expand Down Expand Up @@ -197,7 +201,11 @@ var mysql = require("mysql"),
}
});
} else {
var formatted = (req.baseUrl + req.route.path).replace("/api/v" + api.version, "").replace("/api", "").replace(/\/$/, "");
var formatted = (req.baseUrl + req.route.path)
.replace("/api/v" + api.version, "")
.replace("/api", "")
.replace(/\/$/, "")
.replace("/v" + api.version, "");;
this.defineRoute(formatted, function(definition) {
res
.status((code) ? code : 200)
Expand Down

0 comments on commit e4f54bf

Please sign in to comment.