'use strict';
var routerFactory = require('xpres').Router;
var Server = require('xpres').Server;
var router = routerFactory();
router.use(function(req, res, next) {
console.log('middleware');
next();
});
router.get('/test', function(req, res, next) {
console.log('/test');
});
router.use('/test3', function(req, res, next) {
console.log('/test3 1');
next();
}, function(req, res, next) {
console.log('/test3 2');
});
router.use('/error', function(req, res, next) {
console.log('/error');
next(new Error('some error'));
});
router.use(function(req, res, next) {
console.log('url not found!!!');
});
router.use(function(err, req, res, next) {
console.log('ups!!! error handler', err);
});
var server = new Server(router);
document.addEventListener('DOMContentLoaded', function() {
server.run();
}, false);
-
Notifications
You must be signed in to change notification settings - Fork 0
avoronkin/xpres
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|