Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ST
ga4gh-arraymap
Commits
780dc7bf
Commit
780dc7bf
authored
Sep 21, 2016
by
Severine Duvaud
Browse files
Issue
#2
parent
30379670
Changes
2
Hide whitespace changes
Inline
Side-by-side
beacon-app/public/js/index.js
View file @
780dc7bf
...
@@ -66,7 +66,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', 'BeaconService',
...
@@ -66,7 +66,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', 'BeaconService',
var
conf
=
$scope
.
config
;
var
conf
=
$scope
.
config
;
return
$location
.
absUrl
()
+
"
v0.4/
query?
"
+
return
$location
.
absUrl
()
+
"
query?
"
+
"
referenceName=
"
+
conf
.
referenceName
+
"
referenceName=
"
+
conf
.
referenceName
+
"
&start=
"
+
conf
.
start
+
"
&start=
"
+
conf
.
start
+
"
&assemblyId=
"
+
conf
.
assemblyId
+
"
&assemblyId=
"
+
conf
.
assemblyId
+
...
@@ -82,7 +82,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', 'BeaconService',
...
@@ -82,7 +82,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', 'BeaconService',
$scope
.
getDatasetUrl
=
function
()
{
$scope
.
getDatasetUrl
=
function
()
{
var
conf
=
$scope
.
datasetConfig
;
var
conf
=
$scope
.
datasetConfig
;
return
$location
.
absUrl
()
+
"
v0.4/
dataset?
"
+
return
$location
.
absUrl
()
+
"
dataset?
"
+
"
id=
"
+
conf
.
id
;
"
id=
"
+
conf
.
id
;
};
};
...
...
beacon-app/routes/index.js
View file @
780dc7bf
var
express
=
require
(
'
express
'
);
var
express
=
require
(
'
express
'
);
var
router
=
express
.
Router
();
var
router
=
express
.
Router
();
var
_
=
require
(
'
underscore
'
)
var
_
=
require
(
'
underscore
'
)
var
beacon
=
require
(
'
../arraymap-beacon/v0.4/arraymap-beacon.js
'
);
var
version
=
'
v0.4
'
;
var
beacon
=
require
(
'
../arraymap-beacon/
'
+
version
+
'
/arraymap-beacon.js
'
);
/* GET home page. */
/* GET home page. */
router
.
get
(
'
/
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/
'
,
function
(
req
,
res
,
next
)
{
...
@@ -15,7 +16,7 @@ router.get('/documentation', function (req, res, next) {
...
@@ -15,7 +16,7 @@ router.get('/documentation', function (req, res, next) {
/* GET info page. */
/* GET info page. */
router
.
get
(
'
/info
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/info
'
,
function
(
req
,
res
,
next
)
{
res
.
redirect
(
'
/
v0.4/
dataset?info=true
'
);
res
.
redirect
(
'
/dataset?info=true
'
);
//res.json(beacon.info);
//res.json(beacon.info);
});
});
...
@@ -58,7 +59,7 @@ router.get('/v0.2/query/', function (req, res) {
...
@@ -58,7 +59,7 @@ router.get('/v0.2/query/', function (req, res) {
/* Returns response for API v 0.3 */
/* Returns response for API v 0.3 */
router
.
get
(
'
/v0.3/query/
'
,
function
(
req
,
res
)
{
router
.
get
(
'
/v0.3/query/
'
,
function
(
req
,
res
)
{
beacon
=
require
(
'
../arraymap-beacon/v0.3/arraymap-beacon.js
'
);
var
preconditions
=
beacon
.
checkPreconditions
(
req
.
query
);
var
preconditions
=
beacon
.
checkPreconditions
(
req
.
query
);
if
(
preconditions
.
hasError
)
{
if
(
preconditions
.
hasError
)
{
...
@@ -76,7 +77,7 @@ router.get('/v0.3/query/', function (req, res) {
...
@@ -76,7 +77,7 @@ router.get('/v0.3/query/', function (req, res) {
});
});
router
.
get
(
'
/v0.4/dataset
'
,
function
(
req
,
res
)
{
router
.
get
(
'
/v0.4/dataset
'
,
function
(
req
,
res
)
{
beacon
=
require
(
'
../arraymap-beacon/v0.4/arraymap-beacon.js
'
);
var
preconditions
=
beacon
.
checkDatasetIdentifier
(
req
.
query
);
var
preconditions
=
beacon
.
checkDatasetIdentifier
(
req
.
query
);
if
(
preconditions
.
hasError
)
{
if
(
preconditions
.
hasError
)
{
...
@@ -90,7 +91,37 @@ router.get('/v0.4/dataset', function (req, res) {
...
@@ -90,7 +91,37 @@ router.get('/v0.4/dataset', function (req, res) {
/* Returns response for API v 0.4 */
/* Returns response for API v 0.4 */
router
.
get
(
'
/v0.4/query/
'
,
function
(
req
,
res
)
{
router
.
get
(
'
/v0.4/query/
'
,
function
(
req
,
res
)
{
beacon
=
require
(
'
../arraymap-beacon/v0.4/arraymap-beacon.js
'
);
var
preconditions
=
beacon
.
checkPreconditions
(
req
.
query
);
if
(
preconditions
.
hasError
)
{
res
.
json
(
preconditions
.
msg
);
//Gets error messages
return
;
}
var
mongoQuery
=
beacon
.
buildMongoQuery
(
req
.
query
);
console
.
log
(
"
Building MongoDB query params:
"
+
JSON
.
stringify
(
mongoQuery
));
req
.
db
.
samples
.
aggregate
(
mongoQuery
,
function
(
err
,
docs
)
{
var
response
=
beacon
.
checkResultAndGetResponse
(
req
.
query
,
docs
);
res
.
json
(
response
);
});
});
router
.
get
(
'
/dataset
'
,
function
(
req
,
res
)
{
var
preconditions
=
beacon
.
checkDatasetIdentifier
(
req
.
query
);
if
(
preconditions
.
hasError
)
{
res
.
json
(
preconditions
.
msg
);
return
;
}
var
datasets
=
beacon
.
getDatasets
(
req
.
query
);
res
.
json
(
datasets
);
});
/* Returns response for API v 0.4 */
router
.
get
(
'
/query/
'
,
function
(
req
,
res
)
{
var
preconditions
=
beacon
.
checkPreconditions
(
req
.
query
);
var
preconditions
=
beacon
.
checkPreconditions
(
req
.
query
);
if
(
preconditions
.
hasError
)
{
if
(
preconditions
.
hasError
)
{
...
...
Severine Duvaud
@sduvaud
mentioned in issue
#3 (closed)
·
Sep 21, 2016
mentioned in issue
#3 (closed)
mentioned in issue #3
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment