This is my 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 to put it in the main process as well but it didn't work and I figured it should be implemented in the client-side. The routers doesn't work.
when I use <a href="/all"
it takes me to an empty page and nothing is printed to the console
What am I doing wrong here?
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I'm having some issues trying to send an axios requests with custom headers from my app so I can use them for authentication on my server
Using Redux created reducer, actions and service layer in our applicationI noticed when click back button it is firing the same service again
i am using for loop to retrieve the data from mongodb and display it on the browser but the problem it it iterates only for the first time and stopsSo i get only the first entry as the output
I know this may seem complicated but I have spent a week and a half trying to do this and can not figure it outHopefully someone can point me in the right direction