Skip to content

Commit deb415a

Browse files
committed
path server from client
1 parent f6d12ea commit deb415a

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

client/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var host = location.origin;
12
new Vue({
23
el: '#nodetomicApp',
34
data: {
@@ -13,7 +14,7 @@ new Vue({
1314
methods: {
1415
fetchData: function() {
1516
var self = this;
16-
$.get("http://localhost:8000/api/hello/", function(data) {
17+
$.get(host + "/api/hello/", function(data) {
1718
self.greets = data;
1819
});
1920
},
@@ -23,7 +24,7 @@ new Vue({
2324
username: this.username,
2425
password: this.password
2526
}
26-
$.post("http://localhost:8000/auth/local", user, function(data) {
27+
$.post(host + "/auth/local", user, function(data) {
2728
if (data.token)
2829
self.token = data.token;
2930
});

src/core/swagger.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ export default(app) => {
55

66
if (config.swagger.enabled) {
77

8-
// let host = `${config.server.ip}:${config.server.port}`;
9-
let host = null;
10-
118
// swagger definition
129
let swaggerDefinition = {
1310
info: config.swagger.info,
14-
// host: host,
1511
basePath: '/',
1612
schemes: [
1713
'http', 'https'
@@ -29,28 +25,20 @@ export default(app) => {
2925
}
3026
}
3127
};
28+
3229
// options for the swagger docs
3330
let options = {
3431
// import swaggerDefinitions
3532
swaggerDefinition: swaggerDefinition,
3633
// path to the API docs
3734
apis: [`${config.base}/**/*.yaml`]
3835
};
36+
3937
// initialize swagger-jsdoc
4038
let swaggerSpec = swaggerJSDoc(options);
39+
4140
// serve swagger
4241
app.get('/swagger.json', function(req, res) {
43-
// console.log(req.header('http'));
44-
// console.log(req.secure);
45-
// console.log(req.header('X-Forwaded-Proto'));
46-
// console.log(req.params.pepe);
47-
// let host = req.headers.host;
48-
// let host = req.headers.host;
49-
// console.log(req.get('host'));
50-
// console.log(req.headers.origin);
51-
// swaggerSpec.host = host;
52-
// swaggerSpec.securityDefinitions.iss_a.authorizationUrl =
53-
// console.log(swaggerSpec.securityDefinitions.iss_a.authorizationUrl);
5442
res.json(swaggerSpec);
5543
});
5644
}

0 commit comments

Comments
 (0)