Skip to content

Commit

Permalink
Use local proxy for production build.
Browse files Browse the repository at this point in the history
  • Loading branch information
marc92w committed Nov 20, 2016
1 parent 7b9ff43 commit 8f0346c
Show file tree
Hide file tree
Showing 7 changed files with 172 additions and 158 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ LD-VOWL requires [Node.js](https://nodejs.org/) to be built.
3. Run `npm install` in the root directory of LD-VOWL to install the dependencies.
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.

## Build

To get a production build, run `npm run-script deploy`. After the build is finished, the results will be inside the `dist` directory.

## Tests

In order to run the unit tests, run `npm run-script test`.
Expand Down
6 changes: 5 additions & 1 deletion app/services/extractors/detail-extractor.srv.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ function detailExtractor($http, $q, $log, QueryFactory, RequestConfig, Nodes, Pr

$http.get(requestURL, RequestConfig.forQuery(query, canceller))
.then(function handleExtractedComment(response) {
var bindings = response.data.results.bindings;
if (response === undefined || response.data === undefined || response.data.results === undefined) {
return;
}

const bindings = response.data.results.bindings;

if (bindings.length > 0) {
var newComment = bindings[0].comment;
Expand Down
301 changes: 153 additions & 148 deletions app/services/extractors/relation-extractor.srv.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions app/services/extractors/type-extractor.srv.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ function typeExtractor($http, $q, $log, RequestConfig, QueryFactory, Nodes, Prop

$http.get(requestURL, RequestConfig.forQuery(query, canceller))
.then(function handleExtractedReferringTypes(response) {

if (response === undefined || response.data === undefined || response.data.results === undefined) {
$log.warn('[Referring Types] No results');
return;
}

var bindings = response.data.results.bindings;
const bindings = response.data.results.bindings;

if (bindings !== undefined && bindings.length > 0) {

$log.debug(`[Referring Types] Found ${bindings.length} for '${classURI}'.`);

for (let i = 0; i < bindings.length; i++) {
Expand Down Expand Up @@ -105,7 +103,7 @@ function typeExtractor($http, $q, $log, RequestConfig, QueryFactory, Nodes, Prop
Promises.removePromise(promiseId);
});
}; // end of requestReferringTypes()

} // end of TypeExtractor

export default typeExtractor;
2 changes: 1 addition & 1 deletion app/services/links.srv.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function links(Geometry) {

/**
* @param {{source, target}} d
* @returns number
* @returns {number}
*/
self.getDistance = function (d) {
var distance;
Expand Down
9 changes: 6 additions & 3 deletions app/services/requests/request-config.srv.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
function requestConfig($cookies) {

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

let endpointURL = $cookies.get(cookiePrefix + 'endpoint') || '';
let useProxy = $cookies.get(cookiePrefix + 'proxy') || 'false';
Expand Down Expand Up @@ -56,7 +56,7 @@ function requestConfig($cookies) {
let url;

if (self.getUseProxy()) {
url = proxyURL + self.getEndpointURL();
url = proxyURL;
} else {
endpointURL = self.getEndpointURL();
url = endpointURL;
Expand Down Expand Up @@ -176,9 +176,12 @@ function requestConfig($cookies) {
debug: debug,
format: format,
query: query
//ep: endpointURL
};

if (useProxy) {
config.params.endpoint = endpointURL;
}

if (jsonp) {
config.params.callback = 'JSON_CALLBACK';
}
Expand Down
2 changes: 1 addition & 1 deletion webpack.production.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {

new webpack.DefinePlugin({
__LOGGING__: false,
__PROXY__: false,
__PROXY__: true,
__SESSION_STORAGE__: false,
__SHOW_ENDPOINT__: true,
__VERSION__: JSON.stringify(require('./package.json').version)
Expand Down

0 comments on commit 8f0346c

Please sign in to comment.