This repository has been archived on 2024-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Biblio/api/routes/baseRouter.js

21 lines
545 B
JavaScript

const express = require('express');
const router = express.Router();
const userRouter = require('./userRouter'),
bookRouter = require('./bookRouter'),
borrowRouter = require('./borrowRouter');
// logger
router.use(function(req, res, next) {
if (req.user) {
console.log("User %s: %s %s", req.user.username, req.method, req.url);
} else {
console.log('%s %s', req.method, req.url);
}
next();
});
router.use('/users', userRouter);
router.use('/books', bookRouter);
router.use('/borrow', borrowRouter);
module.exports = router