this code:
<script type="text/javascript"> const express = require('express'), router = express.router(); var hosschemamodel = require('../schema.js') var path = require("path") // const app = express() var port = process.env.port || 8080; router.listen(port); router.get('/requests/:_id', (req, res, next) => { console.log('dynamic link works!!'); hosschemamodel.findone({ _id: req.params._id }, function(err, request){ res.json(request) // res.sendfile(path.join(__dirname+'../homepage.html')) }); }); router.get('/all', (req, res) => { console.log('dynamic link works!!'); res.send('works!!'); // hosschemamodel.findone({ _id: req.params._id }, function(err, request){ // res.json(request) // res.sendfile(path.join(__dirname+'../homepage.html')) // }); }); module.exports = router; </script>
i tried put in main process didn't work , figured should implemented in client-side. routers doesn't work.
when use <a href="/all"
takes me empty page , nothing printed console
what doing wrong here?
Comments
Post a Comment