owl-bt
Version:
owl-bt is editor for Behavior trees. It has been inspired by Unreal engine behavior trees in a way, that it supports special node items like decorators and services. This makes trees smaller and much more readable.
30 lines (25 loc) • 615 B
JavaScript
;
const path = require('path');
const project = require('../../components/project');
exports.index = function(req, res, next) {
let treePath = req.query.path;
if (!treePath) {
res.status(400).send('Missing path');
return;
}
if (!path.isAbsolute(treePath)) {
res.status(400).send('Path must be absolute');
return;
}
project.getProject(treePath)
.then(prj => {
if (!prj) {
res.status(404).send('No project found');
} else {
res.contentType('application/json').send(prj.content)
}
})
.catch(err => {
next(err);
});
};