1
0
Fork 0

added example graph route to aardvark

This commit is contained in:
hkernbach 2015-11-24 15:35:01 +01:00
parent a58157f6b4
commit 94d2e83981
1 changed files with 31 additions and 0 deletions

View File

@ -284,6 +284,37 @@ controller.get("/query/result/download/:query", function(req, res) {
}).summary("Download the result of a query")
.notes("This function downloads the result of a user query.");
/** Create sample graphs
*
* Create one of the given sample graphs.
*
*/
controller.post("/graph-examples/create/:name", function(req, res) {
var name = req.params("name"), g,
examples = require("org/arangodb/graph-examples/example-graph.js");
if (name === 'knows_graph') {
g = examples.loadGraph("knows_graph");
}
else if (name === 'social') {
g = examples.loadGraph("social");
}
else if (name === 'routeplanner') {
g = examples.loadGraph("routeplanner");
}
if (typeof g === 'object') {
res.json({error: false});
}
else {
res.json({error: true});
}
}).summary("Create a sample graph")
.notes("This function executes the internal scripts to create one example graph.");
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------