jade 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 reading

Passing '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 reading

Format 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 reading

How 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 reading

AngularJS: 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 reading

Restangular 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 reading

404 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 reading

Deploy 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 reading

to 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 reading

Puppeteer: 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 reading

Sendgrid 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 reading

Session not updating after redirect

Issue I’m trying to create a login system and having some very strange issues. Page code: const { email, password } = req.body; if(!email ||!password) return res.status(400).send("Missing required fields"); let user = await client.fetchUser({ username: email }); if(!user) user =

Continue reading

how to set filename in express with sendfile()?

Issue I try to set filename on sendfile(). 1 : res.setHeader(‘Content-Disposition’, ‘attachment; filename=’ + result.NAME); res.sendFile(path.resolve(process.env.FILE_PATH +"/" + result.PATH)); 2 : let options = { dotfiles: ‘deny’, headers: { ‘x-timestamp’: Date.now(), ‘x-sent’: true, ‘filename’ : result.NAME }}; res.sendFile(path.resolve(process.env.FILE_PATH +"/" +

Continue reading