You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openNG/src/server/routes/index.js

50 lines
1.2 KiB
JavaScript

"use strict";
const Promise = require("bluebird");
const errors = require("../../shared/errors");
let router = require("express-promise-router")();
router.get("/", (req, res) => {
res.render("layout", {
foo: "bar"
});
});
router.post("/nodes/create", (req, res) => {
res.json({
result: "success",
body: req.body
});
});
// router.get("/node/:uuid", (req, res) => {
// return Promise.try(() => {
// return db.Node.find(req.params.uuid);
// }).then((node) => {
// res.json(node);
// }).catch(db.Node.NotFoundError, (err) => {
// throw new errors.NotFoundError("Could not find a Node with that UUID");
// });
// });
//
// router.post("/autocomplete/type", (req, res) => {
// return Promise.try(() => {
// // FIXME: suggest, https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html
// return elasticCloud.search({
// index: "types"
// })
// })
// })
router.get("/test1", (req, res) => {
res.send("test ONE <a href='/test2'>go to 2 instead</a> <a href='/test2' target='_blank'>or in a new window</a>");
});
router.get("/test2", (req, res) => {
res.send("test TWO <a href='/test1'>go to 1 instead</a> <a href='/test1' target='_blank'>or in a new window</a>");
});
module.exports = router;