Questions tagged [ejs]

0

votes
1

answer
7

Views

One out of two Document property not inserted in a mongoDB collection using: Mongoose and ExpressJS

A Nodejs server application gets Name and Age from an HTML form (with post method) and with the help of ExpressJS and Mongoose has to create a MongoDB document. That works but Age is not written in the document of the collection. Please help me to fix it. Here are the files with the code: personform...
user374324
3

votes
0

answer
72

Views

How do I get more debug information out of i18next?

I have upgraded an app from using webpack-i18n for translations to using i18next (13.1.5). For the most part, everything worked, but on one particular page, none of the text from one of my ejs files is loading. The js file for that page makes a few calls to i18next.t under specific circumstances, an...
James Martineau
1

votes
0

answer
175

Views

Php in EJS is it possible?

Php in EJS is it possible? I want to know if its possible to make php code in ejs? I only need this 3 code lines. password_hash($pass,PASSWORD_DEFAULT); password_verify($pass, $hashpruef) password_needs_rehash
user9191775
1

votes
1

answer
43

Views

Index page in node app only routing to first show page

I'm building a goals app with node/express/psql. When I click on a goal on the index page, I want it to link to the show page for that goal. However, each one is linking to the goal with the id=1. I'm confused because the .forEach I use to print the objects in the first place is working, just not th...
emmarshall
1

votes
1

answer
79

Views

EJS logic works, but html isn't showing

I'm working on a timer using Express.js and EJS. I'm trying to update the html dynamically but i don't get anything displayed. But i get the console.log in my cli. 0 ) { %> This isn't showing This isn't showing CLI Am i missing something obvious? I have other dynamic tags as Send to: but they a...
Irving Cabello
1

votes
1

answer
51

Views

POST Request only works on second time since server startup

Every time I'm restarting up my server the data from the first post request does get saved in var proudctNum, but the whole var request = http.get function goes NAN until I post again. What do I need to do? //Global Vars app.use(function(req, res, next) { res.locals.priceES = null res.locals.lowPric...
Nico Moya
1

votes
0

answer
59

Views

Node.js route error when clicking buttons in .ejs file

I have an edit and delete button in a .ejs file, and problem is that when i click the delete button I am redirected to the edit view file instead of delete code which will delete the data from the database, a second problem is when I try to edit something in the edit view page it doesn't update the...
Brian Polanco
1

votes
1

answer
511

Views

req.user is not being set to res.locals on app.use in express passport node js

I'm new to nodejs, I'm trying to develop a website with two users, a normal user, and a freelancer. When the user logs in res.locals.currentUser is set as the req.user by using the middleware app.use (I'm using the same middleware for both types of user). app.use(session({ secret: 'Rusty is the best...
Raj Crk
1

votes
1

answer
390

Views

How to don't add type of script tag in Webpack?

Actual W3C standard says that it should be not type='text/javascript' in your tag. So in Webpack, inside of HtmlWebpackPlugin I use following settings: new HtmlWebpackPlugin({ faviconhash: Date.now(), template: 'index.ejs', filename: '../index.html', hash: true }) What I get is HTML file that is go...
Edenwave
1

votes
0

answer
434

Views

Proper way to call javascript function in EJS

How can I properly call a javascript function to act on a value coming from EJS code block? My situation is on the front end, where I am parsing a value with a forEach... loop and I want to format a variable with a function I declared in another js file that I included before.
kabuto178
1

votes
0

answer
73

Views

reload 2 or more website and click on specify buttons on this website

I´m looking for a way to create a program that reloads any two websites and then clicks on a specifc div-button on both websites. Any idea? setTimout(function(){ window.location.reload(1); },3000); It could be best if I can get the answere for .pug or .ejs with Javascript. Thank you
1

votes
2

answer
34

Views

GET from 2 different MongoDB collections using MongoJS

I am using MongoJS to fetch data from mongo db in the following way: app.js: var db = mongojs('db', ['events']); And then: app.get('/', function(req, res){ db.events.find(function(err,docs){ res.render('index', { title: 'Events', events: docs }); }) }); This method works, I then fetch it using ejs...
MrG
1

votes
0

answer
26

Views

Error when trying to run a 2nd query node js and sqlite3: SQLITE_RANGE: bind or column index out of range

I am creating an web app that displays a list of names from a sqlite3 database. I am trying to generate a profile page for each name using the user id. I am getting the error 'SQLITE_RANGE: bind or column index out of range'. I have had a look at some similar questions however, I have been unable to...
Cameron
1

votes
1

answer
25

Views

Using node+express with angularjs

For instance, I have index.ejs var app = angular.module('myApp', ['ngRoute']); app.config(function($routeProvider) { $routeProvider .when('/banana', { template : }) .when('/tomato', { template : }); }); Question here is how to render banana.ejs and tomato.ejs like SPA? So, when I click on the 'bana...
Genjik
1

votes
0

answer
55

Views

Including MongoDB entries as EJS tags

I'm working on a hobby project and I would need to include four random objects out of a database collection into my rendered .ejs file. Here's what I have on the server side: app.get('/', function(req, res){ Entry.aggregate( [ { $sample: { size: 4 } } ],function(err, entry){ //get four random entr...
Philipp K
1

votes
1

answer
28

Views

How to improve speed of programatically sending images

I am serving images via express, and substituting generic images when those images don't exist. The HTML which uses those images is generated by EJS looping through an array and creating the img src URLs. This is a simplified version of my code: env people = [ {id: '10937290375', name: 'John Smith'}...
user4893295
1

votes
0

answer
51

Views

Nodejs page is not rendering

I'm making this simple website using Express (Nodejs) and I don't know what's wrong with the web application. It is not rendering contact page in views. I'm using EJS as a view engine. Please tell me what I'm doing wrong. It is showing error 500 on Browser, unable to find anything in response and I...
Sagar Bajpai
1

votes
1

answer
112

Views

How do I resize a image thumbnails in a bootstrap grid?

I have a website where I am displaying campsites. However, I want to resize my thumbnails on the homepage so they are all the same size in a way that the images takes up the exact same dimensions. Hoempage The code for my page is : More Info I tried the following but it doesn't work : .thumbnail #h...
Sarthak Sachdeva
1

votes
0

answer
73

Views

fill datalist html with array passed from .js file

hello guys i dont what i am doing wrong well i have a datebase with cities name and i wont to fill in a datalist html so i did res.render of the table to ejs file but when i try it its doesnt put anything inside the datalist so here what i have done : test.ejs: var mycars = new Array(); for (var...
ZoCode
1

votes
1

answer
680

Views

How to delete a selected row mysql express.js

I'm trying to delete a selected row from database,I already achieved to add data to the database.I'm trying to do the same i did when adding the elements to the database but it seems like it does not work. This is what I have. ID TITLE NEWS Add News And this is the other part of the the program wher...
Rek
1

votes
0

answer
81

Views

Django's jinja like block feature in ejs

I have a node-express project that have several page in it, I use ejs templating engine and currently how I handled base-template is copy-paste the template html to new page (Basically, it's bad) I want to use django's jinja 'block' like feature in ejs, is there that kind of feature in ejs? (I confu...
Hari Anugrah
1

votes
0

answer
25

Views

Pass two parameters by render node.js

I am trying to pass the result of two search by render to the ejs, one variable lists the cities and another the UFs to use in the combobox, but I am not getting, could anyone help? var listaUfes = function(req,res){ var connection = app.infra.connectionFactory(); var ufesDAO = new app.infra.UfesDAO...
Rodrigo Martins
1

votes
1

answer
38

Views

First button in my html doesnt request post, but the other buttons work fine

This is the webpage i have been working on.. Here I have multiple buttons which I got from an ejs for loop(edit buttons, delete buttons). Deleting works fine. But when I click edit, the first edit button doesn't send the post request, but the other buttons do. I cant understand why..... Following is...
dilanSachi
1

votes
1

answer
51

Views

How to query a mongoose database to retrieve one item?

I need someone to please help me with this, so I have several blog posts of in each category in my database, but I only want to display one blog posts in each category on my index view (I'm using ejs), how do I achieve that? I'm new to node.js and mongoose. Please help a brother out. Thanks! I have...
AustinTNM
1

votes
0

answer
74

Views

How to embed ejs loop in parent element

I have this ejs template code that loops through array of objects and returns a page with number of div elements with bootstrap class='card'. read more... But it only returns one div.card inside div.container, and the rest of them outside, after div.container. How do I put all of div.card inside div...
Denis B
1

votes
0

answer
377

Views

Express.js / JWT Tokens - res.cookie with secure

I am using JWT tokens for my backend API. I am using the following code to set cookie when the user first logs in. res.cookie('SESSIONID', token , { httpOnly: true, secure: true }); However, this does not save the cookie (jwt token) in the browser. I tried to remove the 'secure: true' in the option...
umssyed
1

votes
0

answer
64

Views

Use node.js req.params.id and insert the matching id data into a modal with in the same page

Hello I am needing assistance with inserting data from the body to a modal based on the user selection. For example I have a page with buttons, each button data contains a first and last name. When the user selects the button I use req.params.id to match the data from the mongoDB to return the name....
Mark White
1

votes
3

answer
82

Views

forEach Loop not returning Array

So, i seem to be having a problem with returning a value from my forEach MYSQL query loop in Node JS and then inserting this into an ejs template. Currently, these are my pieces of code: app.js GET Request app.get('/admin/stock', function(req, res) { db.query('SELECT * FROM stock', function (err, st...
SomeGenuineGuy
1

votes
1

answer
181

Views

Internal server error when using ejs with expressjs

I'm new to nodejs and I'm trying to use ejs to template my website. But when I tried to set the view engine, I keep getting the error code 500 - Internal Server Error. Here is my app.js: var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger...
1

votes
1

answer
64

Views

Filter events based on user input

This is the design i have. https://i.stack.imgur.com/AmP24.png On the get request i get the data from MongoDB database and render the view. Now i want to filter the data based on the user input on the form. What would be the best approach to do this? This is the ejs template: { %> { %> This is the...
Arlind Bebja
1

votes
2

answer
169

Views

Cannot read property 'totalQty' of undefined

I've created a cart object, which can store the products in a cart. The problem is before an item is put into the cart it is undefined. How do I make the cart defined even when nothing is in it during the session? I'm using ejs. Here is my Error /home/ubuntu/workspace/views/partials/header.ejs:37...
fusionxx23
1

votes
0

answer
218

Views

How to declare variable in EJS?

I want to display array results in my database on the frontend using EJS. So I have the following code: var tagss = [''] But error message keeps telling me that tagss is undefined Here is the full message: full message: ReferenceError: C:\xampp\htdocs\meme.africa\views\pages\meme.ejs:171 169| 1...
Counter J
1

votes
2

answer
147

Views

how to design ejs page with materialize css

I am working with nodejs for communicating with server and storing and retrieving data to and from database. It works fine for me. I'm building a web application for that i used view engine ejs. Now,what i want is to design my ejs page using materialize css.
primo
1

votes
2

answer
440

Views

How to get ejs automatically re-render when firebase is updated

I am building a webapp using Nodejs and generating the HTML page via EJS template. I am fine with the initial page load/refresh, it works as expected, it gets the data from firebase and populates. Later when the firebase collection is updated, re-rendering is not happening not able to see the newly...
bobby.dreamer
1

votes
0

answer
45

Views

Bootstrap tooltip not working with ejs

I am adding the tooltips and I added the script that i see is needed to invoke the tooltip. Also, i am cdn bootstrap popper and jquery. I am working with an ejs file. Is there something that I am missing or is there better way to invoke this so that I can use the tooltips? This is the script I am lo...
Lj Craft
1

votes
0

answer
108

Views

Remove trailing comma from array results using EJS in Node express?

I have an array stored in my MongoDB database. 'tags': [ 'Engineer', 'Programmer' ] But whenever I want to display the results on the frontend using EJS framework the results always come with a trailing comma: Engineer, Programmer. Meanwhile, what I really wanted to have is Engineer Programmer with...
Counter J
1

votes
1

answer
44

Views

how to fix my code?? angularjs, ejs code

I used angular js and ejs. Repeat is good but, Database data does not come in. How should I fix my code? In this angularjs code var app = angular.module('myApp', []); app.controller('BasicCtrl20', function($scope, $http) { $http.get('/concept_db') .then(function(response) { $scope.gridOptions4 = re...
전준휘
1

votes
0

answer
27

Views

Is it possible to call another parital to the harpe js parameter?

I'm harp js user and im curious if its possible to call another parital to the harp js parameter? I would like to proceed with modularization to reuse the code. It is difficult to use the parital function of harp to insert data into a module of a particular module into another module. This is my sou...
evan
1

votes
1

answer
299

Views

Open another ejs file in button ejs

I have an index.ejs file in my NodeJS application. Inside index.ejs file, I want to use a button to open another ejs file with code: Register But when I run application, when I hit that button, it totally return nothing else this error: Cannot GET /register.ejs I even put register.ejs in the same fo...
Thuong Vo Tinh
1

votes
1

answer
258

Views

How to display array in frontend using EJS in Mongodb Node js?

I'm currently building an app where I need to save an array of tags into MongoDB using express js in Node Js. Here is the method I used for saving my tags as an array into MongoDB. app.post('/upload', upload.single('meme'), function (req, res) { if (req.file) { //upload to cloudinary. cloudinary....
Counter J

View additional questions