Issue I’m building a progress bar for some long-running server-side tasks (up to a few minutes), and I’d like a way to display the progress of the task. I could use WebSockets or poll on intervals, but I don’t want
Continue readingTag: express
Alternative to GraphQL long polling on an Express server for a large request?
Issue Objective I need to show a big table of data in my React web app frontend. My backend is an Express server with a GraphQL layer and a few "normal" endpoints. My server gets data from various sources, including
Continue readingController call back function not working in Angular-Express-Bootstrap Seed
Issue I downloaded Angular-Express-Bootstrap seed from https://github.com/jimakker/angular-express-bootstrap-seed. I would like to perform routing through angular js which is performed perfectly. But now I am facing some problem on calling ‘controller’ in controllers.js. I can call my MyCtrl1 by this way
Continue readingMEAN Stack – pass variables from html view to ng-controller
Issue I have developed a profile page which contains several modules such as, let’s say : personal info and friends. Each modules is a ng-controller which makes database calls but I would like to be able to pass the id
Continue readingProblem with static routing in Node.js using express
Issue I am having an issue with some custom routing code, it all works fine and is in sync with the client-side view routing I do, but as soon as I have a subpage, it doesn’t route my static files
Continue readingGET request with parameter dosn't hiting desired route NODE js
Issue The Problem occurs while sending GET or any request with parameters in the URL. for example my index.js const express = require("express"); const bodyParser = require("body-parser"); const app = express(); app.use(bodyParser.urlencoded({ extended: true })); app.get("/:name", function (req, res) {
Continue readingWhy is loopback throwing the error: The `ModelDefinition` instance is not valid
Issue I am taking Strongloop for a spin. I am just trying the “Getting Started” tutorials, and the basic functionality one would typically want/need. I am using Windows and PostgresSQL, so I created a new datasource and edited the model-config.json
Continue readingGet Status of database operation in 'after delete' hook
Issue Today I ran into an issue where I was unable to determine if a delete operation completed successfully in the ‘after delete’ hook. This is problematic, as it requires an additional database operation to determine if the delete was
Continue readingModify image obtained from loopback-component-storage
Issue I am using loopback for storing Image to the server. I want to modify the file name of the file before getting saved to the server. Also I want to convert it to another thumbnail form before getting saved.
Continue readingHow to write remote hook for a method with parameter and relation
Issue I went through the remote hook documentation, I can successfully create remote hooks for methods without extra parameters, like login, which is: customer.afterRemote(‘login’, function(ctx, modelInstance, next) { if (ctx.result) { … next(); } else{ next(); } }); Now, How
Continue readingloopback.io model, acl principalId, $owner
Issue I need to limit data access in a model only to the loopback user that created it. I saw this in the docs: http://loopback.io/doc/en/lb2/Model-definition-JSON-file.html#acls $owner – Owner of the object Does that mean the logged in user who created
Continue readingHow to include the 'many' part of a relation from the 'one of many' model?
Issue I’m trying to get a product, including the category that it is a part of. A category of course has many products and a product is a part of one category. I do this like this. Product.find({include: ‘Categories’}) When
Continue readingUsing loopback-connector-remote to call custom method in another loopback service doesn't create correct URL
Issue I’m trying to connect 2 loopback services, let’s say A and B, using loopback-connector-remote datasource. On B I have this custom remote method: /api/B/myModel/myMethod/{id} This method works fine if I access the API explorer on B service. Then on
Continue readingLoopback default models with a mysql database
Issue I’m trying out loopback and noticed that in the model-config file it has a reference to 5 models that have their dataSource set to the memory database db: “User”: { “dataSource”: “db” }, “AccessToken”: { “dataSource”: “db”, “public”: false
Continue readingHow to make API rate limit policy in loopback
Issue I just want to make an API requests rate limiting per account plan so let’s say that we have users and every user have a plan that has some limits of how many API requests per day they can
Continue readingLoopback CLI created PersistedModel properites not working when model json updated
Issue I’ve created a model using below command line tool in mac terminal and created model name with PersistedModel. lb model I’ve got respective json and js file for model and json structure looks as follows. { “name”: “otp”, “base”:
Continue readingupdate always inserting last array value
Issue i m new to node and search a lot find solution but don’t know how to use with my condition if anyone pro who can help me with this thing Permissiontb.assembleAndInsert = async (ctx, cb) => { for (let
Continue readingHow angularJS ngResource pass variables to expressJS when doing http request operations to server?
Issue The issue here is, that i don’t know how to pass some scope.data to expressjs when using ngResource, so then it can be used with express route to insert something to DB. ExpressJS REST router.route(‘/Data’) .get(function(req,res){ var username =
Continue readinghow to save value of formarray in mysql with nodejs
Issue I have a problem and I want someone to help me. My English is not that good, I’m sorry about that I’ll try my best to explain the problem to you hopefully u can help me and thank you.
Continue readingClient side templates and partial views and express
Issue We have a large amount of client side templating solutions recently including: jquery templates John resig micro templating handle bars EJS and more As far as I can see only jQuery templates support the concept of partials templates (in
Continue readingjade outputs relative links
Issue I’m starting to play with node, express and jade and when I do this a(href=”http:/www.example.com/” + variable) variable I get a relative link, say <a href=”http://127.0.0.1:3000/www.example.com/mytext”>mytext</a> Instead of the absolute link. I’m guessing I’m doing something wrong with the
Continue readingClient side + Server side templating, feels wrong to me, how to optimize?
Issue In the web app I am making, I use the classical Express+Jade to render client pages and also expose some REST API (let’s say : “user list API”). These client pages use provided API to retrieve “user list” and
Continue readingNode.js, Express, Jade & Template in Package
Issue Is it possible to store templates for an express application in a separate package? In my usecase I’d like to have a shared package containing global templages to give all apps the same look and feel even so they
Continue readingWhat is the difference between an include, a partial, and/or a block in templating. EJS / ejs-locals
Issue I have been using EJS with Express and Node.JS for a little while now and I think I understand the basics. I have experimented with the EJS include function which has allowed me to include one template inside of
Continue readingnode.js – using weld with express?
Issue I’m new to node.js, and attempting to use weld to render templates on the server-side and using express as the router. However the examples for node.js doesn’t show serving the content, and am fuzzy on how this would work
Continue readingHow to list variables accessible in a Jade template?
Issue Everything is in the title, it is for debugging purposes! Thank you by advance, I have no idea how to manage it! Solution span.debug #{Object.keys(locals)} you can try out some own things on the old demo site: http://jade-lang.com/demo/ Answered
Continue readingis there jade plugin that would allow manipulation using jquery styled syntax
Issue So say if i have li elements, and i want to use java script to a) find element with class X then add modify some attribute of it. I can run usual JavaScript and it’d be doable, but i
Continue readingEJS rendering on page before for loop finishes/pushed to array
Issue I am attempting to render an array in HTML using EJS. But my EJS is rendering before the data is pushed to the empty array and therefore giving me an empty array rendered on the page. app.set(‘view engine’, ‘ejs’);
Continue readingnodejs / express / oboe.js & pug: Get node() events to update the dom
Issue First time working with node and template engines (yes i know, terrible place to “start” but whatever). I’m building some content from a json stream, and at the end I would like to spit this content out to a
Continue readingHow to get {{>partials} working with Consolidate.js & Mustache?
Issue I cannot get mustache reading partials added like so {{>my_partial}} when using it with consolidate.js. I start my express application with something like: file index.js: var express = require(‘express’), cons = require(‘consolidate’); app.configure(function(){ app.set( ‘models’, BACKEND + ‘/models’ );
Continue readingCan I render multiple sources in EJS
Issue I am attempting to use data from 2 different sources, but render them on the same HTML page using EJS, JS and node. This is what I am trying.. app.set(‘view engine’, ‘ejs’); app.get(‘/’, function(req, res) { res.render(‘index.ejs’, { data:
Continue readingHow can I use the EJS templating engine in nodeJS/express without doing `res.render`?
Issue I would like to res.send a JSON object containing a HTML snippet generated from one of my EJS templates. res.send({ status: “xyz”, timestamp: new Date(), htmlContent: “” //=====> HTML snippet from template.ejs here }); Is that possible somehow? Thanks!
Continue readingres.locals returned undefined
Issue I’m trying to set some response-specific variables, and I’m getting undefined for res.locals when I log it from within my middleware, but it returns the function just fine if I log it from within a route function. // all
Continue readingCan i render dynamic content and use a template engine (ejs)
Issue I am building weather app as a way to practice using express & ejs. I’m using app.get to request info from darkSky’s API. This call is being made once and it is successful, I’m also able to render it
Continue readingInclude HTML blocks Using node.js
Issue This is what I want but probably can’t have: Using node.js and express and maybe ejs, I would like to, while writing a regular HTML file in my client dir, server-side-include a template block of HTML. It would be
Continue readingWhy can't I use a if statement inside of my express handlebars template?
Issue I’ve recently began working on my first Express project and I chose to use Handlebars as my template language because I had some prior experience when creating Ghost blog themes. I’m creating a login screen using Passport.js and connect-flash
Continue readingPassing 'this' inside a subexpression
Issue Currently, I am using the #each helper to loop over an array. This array serves the purpose to pass information create list items with my document const categories = [‘fruit’, ‘vegetables’, ‘dairy’] {{#each categories}} <option value="{{this}}" {{optionSelected product.category (this)
Continue readingUsing Twig render engine with Express
Issue I’ve decided to make the jump from building my websites with slim, php and twig to using node.js and express. To limit the shock of changing my whole process I want to keep using slim as the template engine
Continue readingSpring WebClient partial update with @PATCH method when calling another microservice
Issue I have Node.js and Java services where I am trying to use the PATCH method and update the single item in the request body. When I am sending the below request body directly to the Node.js service(http://localhost:8004/products/xxx) it just
Continue readingFormat footer values in ui-grid
Issue How do I format the aggregate value for a column in ui-grid? With my numbers I get something horrible like total: 6370.046074130321 when I would like total: $6370.05 I tried both: footerCellTemplate: ‘<div class=”ui-grid-cell-contents” >{{COL_FIELD | currency}}</div>’, and footerCellTemplate:
Continue readingI can't deal with SSR React
Issue When I import the react component for the next SSR, it gives an import error, what could be the matter? I don’t want to use type module in package.json Maybe I made a mistake somewhere…..I will be very grateful
Continue readingNext.js: React Apollo Client Not sending cookies?
Issue I’m using Apollo Client as a graphql client on my next.js application, Here is the function that creates a client for me: let client: ApolloClient<any>; export const __ssrMode__: boolean = typeof window === "undefined"; export const uri: string =
Continue readingMust use import to load ES Module: /Users/*path/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js require() of ES modules is not supported
Issue I am trying to use Server-side-rendering in create-react-application but i have been getting the following error. I have tried to update the babel version and change the type : ‘commonjs’ in package.json but is of no use. This is
Continue readingVue + Express(NestJS) Impossible task, You are using the runtime-only build of Vue where
Issue It’s making it impossible for me to add Vue as a view system to a framework called Nest with Express. I didn’t think that adapting Vue was so complicated. That’s why I’m here so that you can guide me
Continue readingHow to read data in express js from form data
Issue Here is request payload I can see in console ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="file"; filename="Screenshot from 2016-12-12 18-34-26.png" Content-Type: image/png ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="userId" 12 ——WebKitFormBoundaryW5j4rbM04jMUgOkU Content-Disposition: form-data; name="isAdmin" true ——WebKitFormBoundaryW5j4rbM04jMUgOkU– I need to read userId which is there name="userId"
Continue readingVariable not updating inside requestJS's data event
Issue I am trying to cache response from a url to a variable and send it on subsequent request. For this I am writing to variable on data event of request. The variable is updated but I am not able
Continue readingAngular ngRoute redirecting to malformed URL
Issue I’m writing an SPA product using AngularJS, being served by Express using NodeJS. NodeJS/Express also provides the API for the SPA. In production the SPA will sit behind a proxy (Apache, or perhaps nginx in the future) – the
Continue readingAngularJS: ngRoute causing too many redirects error?
Issue index.html: <body ng-app=”myApp”> <div ng-controller=”MainController”> … {{ title }} … <div class=”collapse navbar-collapse”> <ul class=”nav navbar-nav”> <li><a href=”#/register” ng-hide=”authenticated”>Register</a></li> <li><a href=”#/login” ng-click=”login”>Login</a></li> <li><a href=”#” ng-click=”logout”>Logout</a></li> </ul> </div> … <div ng-view></div> </div> </body> Ellipses to shorten the html. MainController just
Continue readingRestangular error – "then is not a function" when trying to resolve promise
Issue This is my service. (function() { ‘use strict’; angular .module(‘amazonScraperWebClient’) .factory(‘dataService’, dataService); /** @ngInject */ function dataService(Restangular) { Restangular.setBaseUrl(‘http://localhost:3000’); var data = { getProductList:getProductList }; function getProductList() { return Restangular.all(‘products’).getList(); } return data; } })(); This is the function
Continue readingHow to implement Restangular in a MEAN.js application?
Issue I would like to figure out how to implement Restangular in my mean.js application, i’m doing the routing with angular.js, and i’m using espress.js for the RESTAPI, what i want is to consume the API with Restangular. These are
Continue readingNot able to get json request in express delete with restangular?
Issue Here is the restangular code that i am using to delete the object $scope.delO = (id){ Restangular .one(“footer”,id) .get() .then((ob)=>{ ob.remove(); } .catch…. } The request is being sent properly as i validated in my browser. Here is the
Continue readingHow can I make all my header elements to go through nginx to my node js api
Issue I am sending a request from my vue js app with header { Access-Control-Allow-Headers: "Origin, Content-Type, X-Auth-Token" Access-Control-Allow-Methods: "GET, POST, PATCH, PUT, DELETE, OPTIONS" Access-Control-Allow-Origin: "*" hotel_id: "custom-hotel-id-value-here" token: "custom-token-value-here" } When it gets to my digitalocean droplet, it
Continue readingAPI calls blocked by CORS even with Access-Control-Allow-Origin : * present in headers
Issue API calls from react site keep getting blocked by CORS even tho both the react app and the api are served with Access-Control-Allow-Origin : * header along with allowed methods ‘GET,PUT,POST,DELETE,OPTIONS’ and cors credentials are allowed as well This
Continue readingEC2 Ubuntu NGINX config HTTPS Redirect giving me error: ERR_TOO_MANY_REDIRECTS
Issue Background I’ve got an Ubuntu machine running on an AWS EC2 instance (Node/Express app), with its SSL certs setup using Certificate Manager and a Load Balancer. This worked fine for going to my site directly using https, e.g, https://example.com.
Continue readingReact application – file upload works on localhost but not on nginx server
Issue Hope you can help. the following code works when I run my application on local host, the file uploads correctly to the uploads folder in the root of the application. However when I try uploading a file from my
Continue readinghttp only cookie not working on express js with reverse proxy
Issue Good day people i have a node js appplication which i use nginx as reverse proxy. whenever i set cookie it works but the httpOnly and secure flag is not ticked, please i need solution this is an image
Continue readingNginx Reverse Proxy to Docker 502 Bad Gateway
Issue Spent all week on this one and tried every related stackoverflow post. Thanks for being here. I have an Ubuntu VM running nginx with reverse proxies pointing to various docker daemons concurrently running on different ports. All my static
Continue readingHTTP error body empty using NGINX as reverse proxy
Issue NGINX proxifies my Express NodeJS app. While in my development environment I properly get error codes and error responses, in production I only get error codes without the error response. However, when I run the failing request in PowerShell
Continue reading404 on manual refresh
Issue I’m building my first MEAN app, Angular 6. 0.2, Express 4.16.0 Files have been generated thanks to Angular CLI and Express generator Connection to MongoDB is perfectly running, actually, everything is working BUT the manual refresh… According to the
Continue readingPassport middleware, check if the user already has a living session from
Issue I am building a web application using angular-fullstack. The stack is using express-sessions for session storage (in Mongodb) and passport.js for authentication. I want to limit each user to a single login session. I am trying find a way
Continue readingHow to make my API Private by using cors in angular fullstack generator?
Issue I am using angular fullstack generator for my web app, I want to make my api a private one, meaning the response should be provided only from my domain. If the api is used from a different domain it
Continue readingClient side unable to hit its own server endpoint
Issue I’ve a AngularFullStack project in which I’m trying to hit my project’s server endpoint using the following code, however the problem is the call isn’t going through from angular client side to the nodejs server. Since it’s my first
Continue readingCSRF token missing, Ionic – AngularJS FullStack
Issue I Have a project with the backend on a MEAN stack started with AngularJS Full-Stack generator and an app under Ionic, when i try to do a POST request to do a login from the Ionic app the server
Continue readingHow to display data from backend with a Promise() in Angular?
Issue I would like to display a page from my Backend to my Angular frontend. Backend: at ‘http://localhost:8080/test‘ I display a simple “hello” text. Frontend: at ‘http://localhost:4200/editeur‘ there’s a button. When I click on the button, I would like to
Continue readingRegistration Form REST API Best Practices
Issue I’m building a SaaS application using the MEAN stack and have a few questions regarding how best to secure registration forms. Express.js is what I’m using to generate the endpoints (via angular-fullstack) I have “tenants” that register using a
Continue readingyo angular-fullstack:endpoint message does not generate message.socket.js
Issue yo angular-fullstack:endpoint shopPacket does not generate shopPacket.socket.js I tried to update yo angular full stack generator but still does not work yo angular-fullstack:endpoint shopPacket ? What will the url of your endpoint be? /api/shopPackets create server/api/shopPacket/shopPacket.controller.js create server/api/shopPacket/shopPacket.events.js create
Continue readingExpress.js: TypeError: path argument is required to res.sendFile
Issue I am uploading my files in a directory using Multer. I want to download those same files which I have uploaded as I am displaying them in the form of a table on the template with each file having
Continue readingDeploy Node.js on tomcat
Issue I have developed an application using Angular, Node/Express and MySQL. I have deployed my Angular application on the tomcat server, which is connected to some 10 PCs. However, I want to deploy my backend i.e, Node.js/Express.js on the same
Continue readingAngular file upload without local server?
Issue I’m trying to create a file upload for an Angular application. I would like users to be able to browse their local file system for a file to upload, just like you can do on any number of common
Continue readingShow last inputed value in ejs from sql
Issue I want to Show last inputted value in Ejs from mySql, this in my code js router.get(‘/forming’,showForm); function showForm(req, res, next) { console.log("test1"); var getQuery = "SELECT tableone, mksa FROM myDataBase ORDER BY id DESC LIMIT 1"; let query
Continue readingQuery mongoose for every single element in array
Issue I want to query mongoose for every single element in an array (which itself is also result of a query to mongoose) and append the result to each array element respected and return the array: Service.find(query) .then((servicesList) => {
Continue readingUse return value in a .map after performing request.get
Issue So basically, due to the security, I need to convert image (from the url) to the base64. So far I have two functions. One function is converting the image from the url to the Base64 and the other one
Continue readingI am getting an error "Error: User validation failed" in MongoDB
Issue I am getting an error after trying to use the POST method through postman to register a user. I have created a simple Schema for the register route. Error: Error in register: Error: User validation failed: password: Cast to
Continue readingNode express path hash anchor
Issue I currently have the following url structure in my Node application: http://localhost:3000/#record_2 Clicking on a link like the above will scroll the webpage to the element with the matching id of record_2. But I need extra information which can
Continue readingInternalOAuthError: failed to fetch user profile using express and passport js while implementing twitter strategy
Issue Hello this is my first project using Express and Passport, also my first oauth experience. I did successfully implement Google and Facebook strategies but the Twitter one is resisting since two days ago. It seems the Twitter strategy is
Continue readingHow to use parameters containing a slash character?
Issue My MongoDB keys in person collection are like this: TWITTER/12345678 GOOGLE/34567890 TWITTER/45678901 … I define getPersonByKey route this way: router.route(‘/getPersonByKey/:providerKey/:personKey’). get(function(req, res) { // get person by key var key = req.params.providerKey + ‘/’ + req.params.personKey; // … }
Continue readingExpress middleware runs for every imported .js file, is this normal?
Issue so I set up a basic express app that serves a static file from a directory named public. The public directory contains 3 files "index.html", "script1.js", "script2.js", and "script3.js". The script files are just empty .js files. index.html <!DOCTYPE
Continue readingInsert data on already existing User in mongodb
Issue Can anyone help me solve this problem, I’ve been stuck days on it and haven’t found any solution to. I have this user schema in my mongodb / node js: const userSchema = new Schema({ username:{ type: String, required:
Continue readingIs there a way to request something from the backend and contiously search and refresh the database until it finds a match? then send the response
Issue I am struggling to make my own matchmaking in a multiplayer game of two players. I have a button that says "play",and i want if the user presses it to change in database his schema property "inQueue to true"
Continue readingHow to generate dynamic PDF invoices from a react APP and/or Express API
Issue I’m building a simple React app with an express/node API that allows users make orders for production. I need to find a way to generate dynamic PDF invoices based on the order data – similar to what a webshop
Continue readingReset password doesn't update my password in mongodb base
Issue I am first time making APIs about forgot password and then reset password. I am facing strange issue. There is not a single error, it gives me success status that password is updated. The problem is that in my
Continue readingUsing Firebase Auth with an external database
Issue I’m currently using Firebase to authenticate my users in a React/Node app, but I also want to store additional user data in my own database and I’m doing so by storing the Firebase uid on each user and I
Continue readingMissingSchemaError: Schema hasn't been registered for model "User, userSchema". Use mongoose.model(name, schema)
Issue hope you’re doing well. i’m following a tutorial ( from 2019 ), and i’m facing this error at the moment. here’s the code. ( let me know if you need anything else ) // index.js // const express =
Continue readingWhy is NodeJs cluster module not working?
Issue So basically I am building an express server and I recently looked into the topic of scaling NodeJS apps. One of the first things I saw was the built in cluster module to take advantage of all the threads
Continue readingNot reading data and executing a function that does not exist
Issue So I’m building an API prototype and I have code that reads data from a Google Sheets (serving as a CMS) but the problem is when calling the route that I defined in Express.js it is not reading data
Continue readingDisplay express.js res.send() without overwriting current html
Issue I am trying to create a calculator app using express.js to get request for an html file and a post request that takes the user’s input and responds with the answer. However, I want to display my answer inside
Continue readingIn NodeJS, is res.sendStatus(status).send(message) Invalid?
Issue Whenever I return my HTTP response with : res.sendStatus(status).send(message) I get this error: Exception from a finished function: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client I couldn’t understand where I was sending a response
Continue readingNode Axios POST is throwing 500 error on nested data object but works with a flat object
Issue I am making a very simple POST request with axios in an expressjs app like so: const try = async () => { const axios = require(‘axios’); const output = { url: "www.example.com"} await axios.post(`http://localhost:3000/myapp`, output) // do something
Continue readingsocket.io emits multiple times
Issue I have got a very basic example. This question has been asked previously multiple times in stack overflow itself but I could not get the right answer so I am going with this basic example. Server: var app =
Continue readingDifferences between express.Router and app.get?
Issue 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
Continue readingto be under different domain, why axios.post dont work
Issue https://github.com/skyturkish/e_commerce_advance this is the repo index.js const express = require(‘express’) const bodyParser = require(‘body-parser’) const UserService = require(‘./services/user-service’) const app = express() app.set(‘view engine’, ‘pug’) app.use(bodyParser.json()) app.get(‘/’, (req, res) => { res.render(‘index’) }) app.get(‘/users/all’, async (req, res) => {
Continue readingSeeding my database for FoodApp API using Faker cant use both import and require in the same file
Issue I am trying us use the Faker npm package to seed data into my new database so that I can properly test my filters. The issue is that I am unable to use both require and import in the
Continue readingPuppeteer: Failed to launch the browser process! spawn
Issue When I try to run node app.js, I get error: the message is Failed to launch the browser process! spawn /Users/iliebogdanbarbulescu/Downloads/firstProject/node_modules/chromium/lib/chromium/chrome-mac/Chromium.app EACCES What I did I checked the folder at /Users/iliebogdanbarbulescu/Downloads/firstProject/node_modules/chromium/lib/chromium/chrome-mac/Chromium.app and the file is not zipped. It can
Continue readingSequelize getters do not run on model.findall( { raw:true } )
Issue I have a photo attribute in one of my Sequelize models. I have a getter for it. photo: { type: Sequelize.STRING, get: function () { if (this.getDataValue(“photo”)) return process.env.IMAGE_PREFIX + this.getDataValue(“photo”) else return this.getDataValue(“photo”) } }, but when i
Continue readingHow to trigger mysql query in express
Issue I created a Nodejs Express app with a button on client side. I would like to run a sql query on server side when the button is clicked. Is there a way to do this ? index.ejs <button onclick=’add()’>+1</button>
Continue readingReact escapes already escaped string
Issue I have an app that uses Express + mongoose as its backend, and React as its frontend. On the backend, the validation of user input is done by express-validator the following way: body(‘text’) .trim() .escape() .not() .isEmpty() .withMessage(‘Comment should
Continue readingNode Js – require http is working without npm install but require express is not working
Issue I created a simple project , by running npm init. Now I got a folder backend ->httpserver.js ->package.json Inside, httpserver.js i had as below var http = require("http"); //create a server object: http .createServer(function (req, res) { res.writeHead(200, {
Continue readingSendgrid change href of link
Issue I am using Nodejs with Express and I am sending an email through Sendgrid, but Sendgrid is changing the href link var emailText = ‘<!DOCTYPE html><html><head><meta charset=”UTF-8″></head><body><a href=”https://www.google.com”>Here</a></body></html>’ var from_email = new helper.Email(‘contact@test.com’); var to_email = new helper.Email(‘contact@test2.com’); var
Continue readingnode.js is not updating the variable
Issue I am trying to write one functionality where i am trying to read one csv file , and before that i am trying to check the headers of that perticular csv file are given correctly or not.Below is my
Continue readingCreating a expressjs middleware that accepts parameters
Issue I am trying to create a middleware that can accept parameters. How can this be done? example app.get(‘/hasToBeAdmin’, HasRole(‘Admin’), function(req,res){ }) HasRole = function(role, req, res, next){ if(role != user.role){ res.redirect(‘/NotInRole); } next(); } Solution function HasRole(role) { return
Continue reading