Newest express Questions

Q&A for professional and enthusiast programmers

ExpressJS + Express-mailer No default engine

I've developed my web app using ReactJS and I'm using as a server ExpressJS. Everithing was working fine until I implemented a /contactme endpoint which just must work as restful POST to send an email....

Unable to launch the IIS Express Web server - error on Visual Studio 2015

Unable to launch the IIS Express Web server error on Visual Studio 2015

Route avaliable with or without token JWT+PASSPORT

I want that I can acess a router with or without a token. If user has a token, than give me req.user Like this: router.get('/profile', function(req, res) { if(req.user) { // or if (req....

res.render() into a div with express

I am using nodejs with express and I'm trying to load an ejs into a div like this: app.js (server side) //SHOW app.get("/courses/:id", function(req,res){ console.log("requested"); res.render(...

react hot loader not working with express

I am using react-hot-loader and webpack-hot-middleware with express for live reload but it is not working. webpack listens for the changes but is not shown on the browser. Have i missed something? ...

Facebook authentication through express server for Unity3D application

I want to use express server with passport-facebook to authenticate facebook users. the client side is Unity3D application. I have no problem authenticating users if it was javascript client, since if ...

Webpack2 Hot Module Reloading a Express.js Universal React App

The webpack config of a universal app usually is an array of config objects like: module.exports = [ { name: 'client', entry: { app: [...require("./loaders")....

How to log issues to a file with NodeJS/ExpressJS?

I have my ReactJS and NodeJS/ExpressJS project up and running inside an instance. If there were to be a problem/error while the NodeJS is running, is there a way to report/write to a file in a ...

Node js csurf token always invalid

I have installed the csurf package on a Node.js Exspress app. The token is displaying in the form correctly (it seems), with name="_csrf" and value equal to some hash value, that was set with req....

Express content of page is always visible even on refresh

I'm trying to learn Express and I am trying to build something kinda like bit.ly's web page (The url shortener and stuff) Right now I can get the links to be displayed on page and everything but when ...

GraphQL querying database by passing it as one of resolve arguments

I am interested in learning GraphQL so I can build real fullstack apps. I am trying to query my mongodb in my resolve function inside schema. I am getting error: "message": "mongodb.getCollection is ...

uploading image with express js in openshift and getting the url of uploaded image

I am working on user profile in express where i need to upload user image. i have searched a lot but didn't get much info about this. so this is so far i have done. My profile view code:- <form ...

How to create additional routes in express for application configured for React-Router?

I have to make an API call from my server. It is already configured in a way that every app.use(/* will return index.html. So, now when I create an additional route using app.get('/info', it returns ...

How to install ssl certificates on ubuntu 16.04 on which expressJS application is running?

I am using dokku one-click app on digitalocean for my expressJS application. I deployed my code to dokku and then trying to install ssl certificates on it so that my site will have https. I installed ...

EJS,express, ui-router and angularjs how do they work together?

If i have an angularjs project in project1 then a public folder with index.ejs as the main html how would i set it up in the server.js outside the public folder? how do I make public/index.ejs as a ...

Express React Socket.io Compilation Error

I'm building a web single-page app with react that connects with my express backend using a socket.io websocket. I checked that the socket.io script is being loaded right in my index.html file. I've ...

How would I grab a input from a text box and then spit it out on another page? with javascript

I can't figure out how I would text a input text box save it and then put it in another html with javascript/nodejs. Would I use a document.getElementByID(); Maybe?

How to create a dynamic URL for a dynamic HTML file?

It's easy to render a static website whenever a user requests a webpage on our website. But how can we create a dynamic URL of dynamic HTML pages? Following is the code: var JSONFile = require('../...

Fastest way to proxify images

I have an expressjs+mongoose app on example.com and it needs to store user uploaded images or downloaded from external site. Few time ago image folder get too large. About 30% of users uses url input ...

How to read csv file in node js

I am trying to read a csv file using node js. Her is my code fs.readFile(config.csvUploadPath, function read(err, data) { if (err) { throw err; } console.log(data+'my ...

Add user registration and authentication with React, Redux, and Express

I have a React/redux app using Express and Mongo. I'd like users to be able to sign up for an account however I'm not sure how to get React/Redux to post data to Express. Eventually, I would like to ...

Gulp Task : How to transfer my public directory into my dist folder?

With the following file structure in my Node/Express app, I try to copy the server/public directory into the dist folder, but only the content ( favicon.ico) is transferred: my_app |___ config | ...

Layout is called with express-partials even when layout:false

In my layout.ejs, I use the variable user as follows: <!DOCTYPE html> <html> <head> </head> <body> <div id="user-info">username: <%= user.username %></...

how to use multiple view engine like ejs and jsx in node js?

I am using ejs and jsx both file as template in node.js project but I am unable to find any solution and get error like this: my code where both view engine included given under: //view engine setup ...

Node/Express: Having same socket for all users

I'm new to node/express js and I want to do a real time chatting. I'm using an array to store every socket by user's id on login but it seems the array always recieves the same socket Here is my ...

Fetch() is not returning data from server in response

I'm having an issue with my fetch returning any data from the server and I can't quite seem to understand why. I thought maybe the promise was resolving before the server was sending back any JSON so ...

Add extensions to Express.js?

I try to understand Express. I read some stuff about the routes (that I didnt use yet) and how to implement some extensions with app.use but it doesnt work. I normally setu p Express with express --...

Multiple callbacks in express

I have 2 schemas : Blogdemo and Review. Both in the same file : landing.ejs I want both the content of both the schemas to appear on the landing page. Code : app.get('/', function (req, res,next)...

How to configure package.json and webpack.config.js using routing with nodejs, express and reactjs

I want to render my react component through server.js on single index html page. I have installed all node_modules and dependencies and run two comands in terminal webpack npm start My questions are:...

function not called by nodejs ws-express on connection handler

I've implemented a websockets api on top of a swagger-express node server. For websockets I'm using express-ws which utilises the excellent ws library. However I have come across a problem where the ...

Is passing error to express middleware next function supported?

In the article on Express webisite Writing Middleware The next function does not take any parameters. Most middlewares I've seen do not pass any parameters into next function, but I came across serve-...

Nodejs return data after get request inside a post request

i'm trying to pass get request answer to the post request but can't, can someone help me please? var app = require('express')(); var http = require('http').Server(app); var bodyParser = require('body-...

redirect issues with accessing website on node-express server from another computer

I have a simple website that consume some APIs. This site runs on a node-express server that's hosted on my PC. Currently on the website I send a xmlhttp request to some API, and receive a 303 ...

How to register custom Handlebars helpers?

After a long search I still can't seem to find much information on where to put my custom handlebars helpers. Do I put them in a <script> in my webpage's .hbs file? Do I put them in app.js? Do I ...

How to handle callback URLs in a Single Page Angular/Node.js Web App

I have a single page web app in Node.js/Express and Angular.js and I need to use the Jawbone API to retrieve fitness data. In order to use their API I need to be redirected to the Jawbone website to ...

Simple redirect in Express with static file

I am new to Node and Express. I've got a static html page where the users posts his username via ajax to my server. Then I want to redirect him to another html file. var express = require("express"); ...

serialize user - remember me (passport express)

I have one problem with module remember me (password). When i am registered (as user) everything is ok. I closed my browser and open it again. I try to enter in my service without auth and I get error:...

Uncaught SyntaxError: Unexpected token < in dist/index.html

I am using webpack2 and react hot loader3 with express. I am getting an error of Uncaught SyntaxError: Unexpected token < in dist/index.html Here is my configuration file webpack.config.js ...

expressjs promise & sunc error handling

How do you handle sync errors and promise errors in the same code? here is my code but am not sure its working fine, any ideas ? helpers.list({ limit: 1 }) .then(function(...

My express req.sessions get saved as undefined in Express v4

My express V4 app doesn't give me the correct value of the sessions instead just returns undefined. My app was structured and built using express-generator and this is my app.js file. var express = ...

How do I properly force HTTPS in a Node.js + Express.js application? [duplicate]

I have a basic Express.js application created with express-generator. When I write "localhost:3000" in the browser I want it to add "https://" in front, not "http://", like typing "facebook .com" does....

Update content of page from a POST request in Express

I had a problem where I tried to update the contents of the web page through a POST request that was done through a form but the problem is that the variables were set to the global scope and every ...

How to select specific span out of several dynamically generated by Handlebars?

My webpage shows data of several items - I use a handlebars loop (as seen below) to generate and populate the content and divs for each item. I don't have a static number of items, there could be ...

Render data sent to Express post router

I'm starting with Express and I have a question; I have the setup and everything, I've made some simple things but know I want to interact with an API, to do what I want to do I need to the data that ...

Express Middleware Issue

On routes/index.js it works fine if I leave the module.exports = routes; But If I change it to the following to allow multiple files then I get a middleware error: module.exports = { routes }; ...

Include 3rd-party plugin only to specific MEAN Stack module

I have a search module for a project developed in MEAN Stack. Currently I am adding all 3rd party plugins link(map plugin) to default.js in config/assets folder. Is there a way where i can load only ...

Using only JsonSchema with Mongoose possible?

I have an api using express, mongodb and I use AJV validation to validate the incoming requests. //JSONSchema var recordJsonSchema = { type: "object", properties: { name: { type: "...

Generating list of React elements server-side

Hoping this is just a small issue, but I have this in my Express server: app.get('/', function(req, res) { res.send(ReactDOMServer.renderToString(React.createElement(App))); }); But there's a ...

How to call a function at start in Node-Express, with dbconnection

I'm a little bit newbie with Nodejs. I'm working in a Nodejs - express solution (as webservice of an angularjs web). I want to send and e-mail when MSSSQL database query gives back some information. ...

NodeJS Session Management in Main

I'm newish to NodeJS and ExpressJS and am trying to get the session management flow in main.js worked out. What I currently have that's working: app.get('*', function(req, res){ var page = ...
Translating... 0%