var Router = require("Router");

var appRouter = new Router();
var UADetector = require('UADetector');

appRouter.get("/uadetector",function(req,res) {
  res.setBody({
    your_useragent_is : req.headers['User-Agent'],
    UADetector_says_this : UADetector(req)
  });
});

appRouter.all('/*catchall', function(req,res) {
  res.setBody({
    links :[
    {title: 'Output from UADetector', href: baseUrl+'/uadetector'}
  ]});
});

module.exports = appRouter;
Example #2
0
      return {session:session, presenters:presenters};
    });

    return result;
  });

  filteredData = wenn(data).then(function(data) {
    return _.map(data, function(obj) {
        return jsonmask(obj, "session/name,presenters/(firstName,lastName)");
    });
  });

  res.setBody(filteredData);
});

appRouter.get("/hello", function(req,res) {
  res.setBody({message: "Hello World!"});
});

appRouter.all('/*catchall', function(req,res) {
  var helloUrl = baseUrl.toString()+'/hello';
  res.setBody({
    links :[
    {title: 'Hello world', href: baseUrl+'/hello'},
    {title: 'Raw Sessions', href: baseUrl+'/rawSessions'},
    {title: 'Sessions', href: baseUrl + "/sessions"}
  ]});
});

module.exports = appRouter;
          latitude : latLonArray[0],
          longitude : latLonArray[1]
        };
      })
      .filter(function(site){
        return (!req.parameters.state || req.parameters.state.toLowerCase() == site.state.toLowerCase())
          && (!req.parameters.name || req.parameters.name.toLowerCase() == site.name.toLowerCase());
      })
      .sortBy(['state','name'])
      .value();
    return latLonArray;
  });
  res.setBody(cityList);
});
appRouter.all('/*catchall', function(req,res) {
  res.setBody({
    note:'All /weather/CA endpoints are bilingual; set your Accept-Language to fr-CA to test.',
    links :[
    {title: 'Canadian weather stations, supports query params [province, name] (XML)', href: baseUrl+'/weather/CA{?province,name}', templated: true},
    {title: 'Weather stations in Ontario', href: baseUrl+'/weather/CA?province=ON'},
    {title: 'Weather stations named \'Toronto\'', href: baseUrl+'/weather/CA?name=Toronto'},
    {title: 'Canadian weather by weather station (XML)', href: baseUrl+'/weather/CA/{province}/{stationID}', templated: true},
    {title: 'Toronto weather', href: baseUrl+'/weather/CA/ON/s0000458'},
    {title: 'Lat/Lon of US Cities (SOAP/XML)', href: baseUrl+'/cities/US'},
    {title: 'US weather by zip (SOAP/XML)', href: baseUrl+'/weather/US/{zip}', templated: true},
    {title: 'The weather in NYC', href: baseUrl+'/weather/US/10036'}
  ]});
});

module.exports = appRouter;
var Router = require("Router");

var appRouter = new Router();

appRouter.get("/hello", function(req,res) {
  res.setBody({message: "Hello World!"});
});

var helloService = spring.getBean("helloService");
appRouter.get("/hello-spring", function(req,res) {
  res.setBody({message: helloService.getHelloMessage()});
});


var echoModule = require('/modules/echoModule');
appRouter.get("/echo/:message", function(req,res, message) {
  res.setBody(echoModule.echo(message));
});

appRouter.all('/*catchall', function(req,res) {
  res.setBody({
    links :[
    {title: 'Hello world', href: baseUrl+'/hello'},
    {title: 'Hello world, using a Spring Bean to return the hello message ', href: baseUrl+'/hello-spring'},
    {title: 'Echos the message back. Also an example of module definition and loading.', href: baseUrl+'/echo/{message}', templated: true},
    {title: 'Echos the message "hello"', href: baseUrl+'/echo/hello'}
  ]});
});

module.exports = appRouter;