ejs Questions
3
Solved
What I'm trying to achieve is some sort of way to cache results of a mongoDB/Mongoose query that I can use in my views and routes. I'd need to be able to update this cache whenever a new document i...
6
I am using Express and EJS to build a site and
I have a directory structure somthing like:
+--www/
|
+--partials/
| |
| +--header.ejs
| +--(a bunch of ejs files)
|
+--guide
| |
| +--ind...
3
Solved
I want to use a variable which is declared in javascript file to a ejs file.
javascript:
var express = require('express');
var app = express();
var myVar = 1;
In the ejs file , where I want to...
Alonzoaloof asked 3/6, 2016 at 14:14
10
Solved
I'm working on a Node.js app (it's a game). In this case, I have some code set up such that when a person visits the index and chooses a room, he gets redirected to the proper room.
Right now, it...
Tuna asked 2/7, 2012 at 8:2
2
how do i convert this buffer data to an image so when am looping thru the result and rendering it in the img src it will render as an image that the user can see
am using ejs to render it
<sp...
Padriac asked 27/2, 2020 at 23:50
9
Is it possible to use console.log in a node / ejs template? It doesn't seem to do anything when I try, even something as simple as:
<% console.log('test') %>
I've also tried:
<%= conso...
2
How do I reference the hashed image (in the html page in the dist folder) after it has been created with copy-webpack-plugin?
I tried to resolve this problem in this way.
I have in my index.ejs fil...
Calvin asked 5/1, 2023 at 9:14
2
Solved
I want to use prettier for formatting my ejs files by adding custom rules.
Right now I am using files associations of html for ejs files.
I have added the following code in the settings.jso...
Galegalea asked 15/5, 2019 at 4:47
6
I am trying to develop a guestbook app which stores users names, country and users message sin mongodb, the connection is ok, I can submit these 3 infos(username, country and message)in the db. My ...
8
Solved
I switched my nodejs template engine over to ejs (from jade). When I run my app.js with my ejs template, I receive a series of "Failed to lookup view 'error' in views" logs.
Some of which include:...
Henderson asked 24/2, 2016 at 14:22
4
Solved
I have the following schema with required validations:
var mongoose = require("mongoose");
var validator = require("validator");
var userSchema = new mongoose.Schema(
{
email: {
type: String,
...
Andrus asked 6/4, 2020 at 8:46
1
This User's route with Puppeteer code:
Router.get('/generate_invoice', (req, res) => {
const userData = req.session.user;
res.render("./patientpanel/invoice", { user: userData });
...
Angelitaangell asked 30/10, 2022 at 17:43
2
Solved
I have an Express.js app set up using EJS templates. I successfully looped through an array with classic JS syntax:
<% for (var i = 0; i < myArray.length; i++) {
this = myArray[i];
// dis...
Clearcut asked 22/4, 2013 at 17:43
14
Solved
I am trying to use Embedded Javascript renderer for node:
https://github.com/visionmedia/ejs
I would like to know how I can include another view file (partial) inside a .ejs view file.
2
Solved
I try to render html with ejs like this
const ejs = require('ejs'),
fs = require('fs'),
str = fs.readFileSync(`${__dirname}/../mail_templates/test.ejs`, 'utf8');
console.log(ejs.render(str, {na...
4
Solved
I have a page that makes a foreach and show some photos like this
<% imgs.forEach(function(img) { %>
<img src="uploads/<%=user.username%>/screenshots/<%= img %>">
<% }...
Phalangeal asked 17/12, 2016 at 19:24
4
I always wanted to learn NodeJS to be able to run the same code on server and client side.
I am using NodeJS with Express and EJS.
So. I have a .ejs page with lot's of HTML, JS, CSS and a small bi...
Newsmagazine asked 6/12, 2016 at 17:44
6
Solved
I am trying to learn node.js.
I have the following code.
var express = require('express');
var app = express();
var port = process.env.PORT || 5000;
app.use(express.static('public'));
app.use(e...
6
I have a results variable that is an array of objects. I carry the results variable from my javascript file to my main route file. I am trying to render my page to display lists of each object in m...
2
Solved
Sample code snippet:
index.ejs
<p><a href="<%=link%>" class="btn btn-primary" role="button">Download</a></p>
app.js
var express = require('express'); var route...
4
I'm using ejs in backend with nodejs.
I'd like to pass variable when include. When include the header, pass the page title.
index.ejs:
<% include header %>
<body> . . . </body>
...
Eglanteen asked 21/5, 2014 at 16:22
4
Solved
I am using the Forms library for Node.js (Forms), which will render a form for me on the backend as so:
var signup_form = forms.create({
username: fields.string({required: true})
, password: fie...
5
Solved
I have codes in EJS below,
<script>
var row =<%-JSON.stringify(data)%>
console.log(row);
</script>
<% for(var i=0; i<JSON.stringify(data).length; i++) {%>
<tr>
...
3
Im using express-ejs-layout for my project. my project has routing. I want use different layout for different res queries. for example if query is: www.example.test/a, use LayoutA.ejs, if query is:...
Ribble asked 19/8, 2018 at 1:48
4
Solved
In my index.ejs I have this code:
var current_user = <%= user %>
In my node I have
app.get("/", function(req, res){
res.locals.user = req.user
res.render("index")
})
However, on the p...
Buffoon asked 9/12, 2012 at 14:29
© 2022 - 2024 — McMap. All rights reserved.