This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "myweb", | |
| "version": "0.0.1", | |
| "dependencies": { | |
| "jquery": "~1.8.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var router = require('express').Router(); | |
| router.use(require('permission.js')('manageUsers')); | |
| /* GET users listing. */ | |
| router.get('/', function(req, res) { | |
| res.send('respond with a resource'); | |
| }); | |
| /* GET a user */ | |
| router.get('/:id', function(req, res) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* GET a user */ | |
| router.get('/:id', require('permission.js')('canViewUserDetails'), function(req, res) { | |
| res.send('This is the user id ' + req.params.id); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Returns a middleware that checks the permission in the user's session | |
| * @param permission | |
| * @returns (Function) A middleware that check the user's permission. | |
| */ | |
| module.exports = function (permission) { | |
| return function (req, res, next) { | |
| if (permission && req.body.permissions.indexOf(permission) == -1) { | |
| debug('User has no permission'); | |
| if (req.xhr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var router = require('express').Router(); | |
| /* GET users listing. */ | |
| router.get('/', function(req, res) { | |
| res.send('respond with a resource'); | |
| }); | |
| module.exports = router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var app = require('express')(); | |
| app.use('/users', require('./routes/users')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace solbs\bookingengine\services; | |
| use mysqli; | |
| use solbs\bookingengine\model\Reservation; | |
| class LoggingService | |
| { | |
| /** | |
| * @param MyObject $myobject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* GET home page. */ | |
| router.get('/', function(req, res) { | |
| res.render('index'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install justhtml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| app.set('views', path.join(__dirname, 'views')); | |
| app.set('view engine', 'jade'); |