I am a learner in Node.js.
What's Express.js?
What's the purpose of it with Node.js?
Why do we actually need Express.js? How is it useful for us to use with Node.js?
What's Redis? Does it come with Express.js?
I don't understand why we need body-parser in an Express application, as we can get data without using body-parser.
And what does it do actually and how?
How would you explain the workflow of Passport's serialize and deserialize methods to a layman.
Where does user.id go after passport.serializeUser has been called?
We are calling passport.deserializeUser right after it where does it fit in the…
In Ubuntu it's quite simple; I can run the application using:
$ NODE_ENV=production node myapp/app.js
However, this doesn't work on Windows. Is there a configuration file where I can set the attribute?
How can I download a file that is in my server to my machine accessing a page in a nodeJS server?
I'm using the ExpressJS and I've been trying this:
app.get('/download', function(req, res){
var file = fs.readFileSync(__dirname +…
I am facing an issue on getting the value of tagid from my URL: localhost:8888/p?tagid=1234.
Help me out to correct my controller code. I am not able to get the tagid value.
My code is as follows:
app.js:
var express = require('express'),
http =…
I'm receiving this error when trying to debug my node application using the npm start command.
Error:
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"…
I'm running an Express.js application using Socket.io for a chat webapp
and I get the following error randomly around 5 times during 24h.
The node process is wrapped in forever and it restarts itself immediately.
The problem is that restarting…
All of a sudden this has been happening to all my projects.
Whenever I make a post in nodejs using express and body-parser req.body is an empty object.
var express = require('express')
var bodyParser = require('body-parser')
var app =…
I have come across CORS issues multiple times and can usually fix it but I want to really understand by seeing this from a MEAN stack paradigm.
Before I simply added middleware in my express server to catch these things, but it looks like there is…
I'm sending the following JSON string to my server.
(
{
id = 1;
name = foo;
},
{
id = 2;
name = bar;
}
)
On the server I have this.
app.post('/', function(request, response) {
…
I don't completely understand how I should get a remote user IP address.
Let's say I have a simple request route such as:
app.get(/, function (req, res){
var forwardedIpsStr = req.header('x-forwarded-for');
var IP = '';
if…
How do you call a function from within another function in a module.exports declaration?
app.js
var bla = require('./bla.js');
console.log(bla.bar());
bla.js
module.exports = {
foo: function (req, res, next) {
return ('foo');
},
…
I'm starting with NodeJS and Express 4, and I'm a bit confused. I been reading the Express website, but can't see when to use a route handler or when to use express.Router.
As I could see, if I want to show a page or something when the user hits…