Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var express = require('express');
- var router = express.Router();
- router.get('/', function(req, res, next) {
- res.render('index', { title: 'Express' }
- );
- });
- router.get('/:id', function(req, res, next){
- const db = require("../db");
- var formata_id = req.params.id;
- db.findPosts(formata_id.toLowerCase(),function(err,docs){
- global.docs_info = docs;
- });
- db.findInfo(formata_id.toLowerCase(),function(err,informacao){
- global.info = informacao;
- if(!global.info || global.info == 0){
- res.render("erro2");
- }
- });
- res.render('show', { title: 'Express', inform: global.info, post: global.docs_info, parametro_id: req.params.id});
- });
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement