Skip to content

Commit 8f0346c

Browse files
committed
Use local proxy for production build.
1 parent 7b9ff43 commit 8f0346c

7 files changed

+172
-158
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ LD-VOWL requires [Node.js](https://nodejs.org/) to be built.
1313
3. Run `npm install` in the root directory of LD-VOWL to install the dependencies.
1414
4. Run `npm run-script start` to start a local webpack development server on port 8080 or run `npm run-script deploy` for a production build.
1515

16+
## Build
17+
18+
To get a production build, run `npm run-script deploy`. After the build is finished, the results will be inside the `dist` directory.
19+
1620
## Tests
1721

1822
In order to run the unit tests, run `npm run-script test`.

app/services/extractors/detail-extractor.srv.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ function detailExtractor($http, $q, $log, QueryFactory, RequestConfig, Nodes, Pr
3232

3333
$http.get(requestURL, RequestConfig.forQuery(query, canceller))
3434
.then(function handleExtractedComment(response) {
35-
var bindings = response.data.results.bindings;
35+
if (response === undefined || response.data === undefined || response.data.results === undefined) {
36+
return;
37+
}
38+
39+
const bindings = response.data.results.bindings;
3640

3741
if (bindings.length > 0) {
3842
var newComment = bindings[0].comment;

app/services/extractors/relation-extractor.srv.js

+153-148
Large diffs are not rendered by default.

app/services/extractors/type-extractor.srv.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,14 @@ function typeExtractor($http, $q, $log, RequestConfig, QueryFactory, Nodes, Prop
3737

3838
$http.get(requestURL, RequestConfig.forQuery(query, canceller))
3939
.then(function handleExtractedReferringTypes(response) {
40-
4140
if (response === undefined || response.data === undefined || response.data.results === undefined) {
4241
$log.warn('[Referring Types] No results');
4342
return;
4443
}
4544

46-
var bindings = response.data.results.bindings;
45+
const bindings = response.data.results.bindings;
4746

4847
if (bindings !== undefined && bindings.length > 0) {
49-
5048
$log.debug(`[Referring Types] Found ${bindings.length} for '${classURI}'.`);
5149

5250
for (let i = 0; i < bindings.length; i++) {
@@ -105,7 +103,7 @@ function typeExtractor($http, $q, $log, RequestConfig, QueryFactory, Nodes, Prop
105103
Promises.removePromise(promiseId);
106104
});
107105
}; // end of requestReferringTypes()
108-
106+
109107
} // end of TypeExtractor
110108

111109
export default typeExtractor;

app/services/links.srv.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function links(Geometry) {
3535

3636
/**
3737
* @param {{source, target}} d
38-
* @returns number
38+
* @returns {number}
3939
*/
4040
self.getDistance = function (d) {
4141
var distance;

app/services/requests/request-config.srv.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
function requestConfig($cookies) {
1010

1111
const cookiePrefix = 'ldvowl_';
12-
const proxyURL = 'http://cors-anywhere.herokuapp.com/';
12+
const proxyURL = 'http://localhost/proxy.php';
1313

1414
let endpointURL = $cookies.get(cookiePrefix + 'endpoint') || '';
1515
let useProxy = $cookies.get(cookiePrefix + 'proxy') || 'false';
@@ -56,7 +56,7 @@ function requestConfig($cookies) {
5656
let url;
5757

5858
if (self.getUseProxy()) {
59-
url = proxyURL + self.getEndpointURL();
59+
url = proxyURL;
6060
} else {
6161
endpointURL = self.getEndpointURL();
6262
url = endpointURL;
@@ -176,9 +176,12 @@ function requestConfig($cookies) {
176176
debug: debug,
177177
format: format,
178178
query: query
179-
//ep: endpointURL
180179
};
181180

181+
if (useProxy) {
182+
config.params.endpoint = endpointURL;
183+
}
184+
182185
if (jsonp) {
183186
config.params.callback = 'JSON_CALLBACK';
184187
}

webpack.production.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = {
4949

5050
new webpack.DefinePlugin({
5151
__LOGGING__: false,
52-
__PROXY__: false,
52+
__PROXY__: true,
5353
__SESSION_STORAGE__: false,
5454
__SHOW_ENDPOINT__: true,
5555
__VERSION__: JSON.stringify(require('./package.json').version)

0 commit comments

Comments
 (0)