I am looking for a way to include additional variables to be utilized by EJS during the rendering of a view for every request, similar to adding them in the render function: res.render('view', {data: {my: 'object'}}); I have implement ...
I am attempting to send an object called dataO from Node.js/Express/EJS to the client side. On the Node.js script side: var dataO = {"first":[20000, 14000, 12000, 15000, 18000, 19000, 22000], "second":[12000, 11000, 18000, 12000, 19000, 14000, 26000]}; var ...
I have successfully created a pair of HTML files - index.html & contact.html. Within these files, I have implemented a navigation bar that allows for seamless transition between them. Recently, I delved into the realm of retrieving APIs and crafted an app ...
Despite creating a static public folder in app.js, When I visit "http://localhost:3000/calendars/add", the styles from the public folder are not applied. This is because Express has appended "calendars/add/" to the public folder URL. As a result, it appe ...
I am currently engaged in a project for a small theater group, and I am facing challenges with getting this loop to execute properly. <% include ../partials/header %> <div class="jumbotron jumbotron-fluid"> <div class="container"> ...
I need assistance finding a solution to my question. Can my friends help me out? What types of requests do I receive: facebook, linkedin, reddit I want to simplify my code and avoid writing lengthy blocks. How can I create a check loop to send the same ...
Software Dependencies: "ejs": "^3.1.9", "express": "^4.18.2", The structure of my project directory is as follows: /usr/src/app/ | |- app.js |- api/routers/main.js |- website |- src/views/myView.ejs |- r ...
I have a node server sending three arrays to my .ejs page and I want the display to look like this: Image But currently, it looks like this: Image Below is the code snippet: <div class="webvUI-panel__bd"> <a href="javascript:void(0);" class= ...
Currently, I am utilizing NodeJS/Express and EJS to develop a form for an API route. However, when attempting a POST request and accessing req.body.password & req.body.confirm, I consistently receive "undefined" as the response. index.js import http from ...
I'm facing an issue with my web app that involves the use of express.js. I attempted to embed a pdf file within a .ejs file by using the following code snippet: embed src="mypdf.pdf" width="500" height="375" /> Upon loading the page, I encountered the ...
I am attempting to display a list of participants when the user clicks on the button. However, every time I try, I encounter an error stating "document is not defined". (Please refrain from suggesting the use of jQuery!). <% var btn = document.getEle ...
As I venture into learning Node JS, I am currently transitioning from a client-side chat application to a server-side one. Previously, when my app was solely client-side, any modifications to the database automatically triggered data reload in a div, provi ...
Currently, I am working on improving my knowledge of java-script and had the idea to create a basic chat app using Express, stock.io, and ejs. Unfortunately, I am facing some challenges in getting it up and running smoothly. Below is the snippet from my ...
Currently, I am working on a project that utilizes express.js for backend functionality and ejs as the rendering template for frontend. As part of this project, I have uploaded some images using filepond which were then converted to base64 format. However, ...
I am facing an issue while setting up a registration page with express-validator. After upgrading the middleware to version 6.2, I started receiving an error when trying to run my app. It seems to be related to the Validator section, as it was working fine ...
I am in the process of developing a childcare management web application using NodeJS with ExpressJS, mongoose, and EJS. The application features a module for adding participants and another module to track each participant's daily meal count four tim ...
I've encountered an issue while trying to pass multiple mongoDB queries to my EJS view using the code below. Surprisingly, only the "mvl" query is getting passed down successfully. The "extras" query seems to be unavailable as none of its values show up on ...
There is a page '/order/new' with 2 dropdown menus for customer and their address, along with a button that redirects to choose products to add to the order. The selected products are saved in an array called 'hh' which receives data from an AJAX call. How ...
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Vid Chat App</title> </head> <body> <video controls autoplay> </video> <script src="https: ...
When using a restaurant food menu generator, I am able to view it with HTML by utilizing the following code: app.get('/', function (req, res) { res.sendFile(__dirname + '/views/index.html'); }); This method uses express static. Bu ...
I am currently working in a Node environment and using gulp for SASS, EJS for templates. I'm also trying to incorporate Browser Sync into my setup but running into some configuration issues with my gulp file. When I run 'node server.js', my app loads in th ...
I am looking to retrieve a specific file and pass it to an embedded JavaScript (ejs) template. Can someone guide me on how to successfully transfer the file from a node endpoint to the embedded JavaScript template? ...
I've hit a roadblock with what I thought was a simple task. My goal is to create a link that will open a PDF file in a new tab, rather than automatically downloading it. Just to clarify, I already have the PDF file ready and saved. Here's a snip ...
After my initial attempt at creating a basic node app, I discovered that the scraper module was working correctly as data was successfully printed in the command window. Additionally, by setting eventsArray in index.js, I confirmed that Express and Jade te ...
I am displaying some data from my express to ejs in HTML tag format. It appears correctly on the ejs template page and the web page. However, when I check the page source, the HTML tags are encoded and displayed as unescaped characters. Is there a solution ...
Upon executing my main.ts script using deno, I encounter the following error message: error: Failed to retrieve compiled source code from https://deno.land/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bfcccbdbff8f918a86918f"& ...
I have a query let data = ctx.get("list.json"); ctx.set("Content-Type", "application/json"); await ctx.render('index', { somecontent:onecontent, seconddata: list }); In index.ejs <%=second ...
Hey there! I'm diving into the world of Node.js on my own and hitting a stumbling block that seems simple but is causing me some serious frustration. Despite countless searches on Google, I can't seem to figure it out due to fatigue setting in. I ...
I've been delving into learning node.js using the book "Get programming with node.js" by Jonathan Wrexler. However, I'm currently stuck on understanding how to implement partials as explained in chapter 10. In an attempt to create a navigation partial, I ...
For instance, there is a public folder that contains all the css files, and a separate view folder for ejs files. When linking the css file in the ejs file, the code usually looks like this: <link rel=”stylesheet” href=”styles.css”> or like ...
My application is only operational on port 3000. If I attempt to switch to a different port, it functions correctly. However, upon loading a page, an error occurs: abc is not defined at eval (eval at compile (C:\Users\ASUS\node_mod ...
I'm just starting to learn about Node JS. Here's the code I've been working on. I'm having trouble rendering new data after an AJAX call. Is this the correct way to update data without refreshing the entire page? Is there a more efficient method to only lo ...
app.get('/', (req, res) => { const articales = { title: 'Test Articles', createdAt: Date.now(), description: "Test Description" } res.render('index', { articales : articales }) }) <div ...
I am currently building a basic todo list application using EJS. However, I am encountering an issue when running it. I would like to run app.js with the header and footer in EJS, but it seems that it is not recognizing the header despite using what I beli ...
When setting local variables in the /login router as shown in the code snippet below: res.locals.username = data[0].username;, I have checked the output using console.log for both data[0].username and res.locals.username, and it correctly displays the user ...
I'm facing what appears to be a simple issue, yet struggling to locate comprehensive documentation on it. My goal is to pass JSON data from mongodb into a route for it to be accessible in my ejs template. Here is my schema: var GiveSchema = new Schema( ...
I am facing an issue while trying to open the places.ejs file by clicking the submit button on the show.js page. Similar to how the show.ejs page opens upon clicking the submit button on the new.ejs file, I am encountering a reference error. Any assistance ...
While developing a web application using node.js, express, and the express generator, I noticed that the template files in the "view" folder end with .pug extensions. Shouldn't they be .ajs files instead? Is there a way to change this setting? I'm still ...
Currently, I am working on an EJS login project and I have created a style.css file with the following code: [theme="bloodRed"] { background-color: #ff2424; color: #e571e1; accent-color: #00ff00; } In my register.ejs ...
In order to demonstrate a simple login page, I have created a form that requests typical information like username, password, etc. Additionally, it prompts the user to confirm their password, and if the lengths do not match, an error is triggered to notify ...
My task is to dynamically display different templates based on the route, which in this case are /edit and /new. I need a condition to determine whether to show tabs or something else. In my router.get('/edit' cb) function, I tried checking if res.url.inc ...
Looking to create a JSON model or schema for storing form input data on a local JSON file, I have experience with MongoDB but want to keep it simple in this project by using a basic JSON file. Is there a way to structure the data similar to a Mongoose sche ...
Recently, I encountered an issue while using EJS (version - 0.8.4) after making some changes to the file: node_modules/lib/ejs.js at line ~ 155 : The old code looked like this: if (0 == js.trim().indexOf('include')) { var name = js.trim().slic ...
https://i.stack.imgur.com/91bPg.png Issue: Unable to find the "index.ejs" view in the views directory ...
I am encountering an issue with my basic node express application. The root route loads fine, but additional routes such as /about or /services are not working correctly. Even though I can change the EJS template for the homepage and it renders properly, ...
Recently delving into the world of node development, I encountered an issue with my EJS template not rendering basic data. I have two controllers - one for general pages like home/about/contact and another specifically for posts. When navigating to /posts ...
For my school project, I am using Express.js with TypeScript to create a simple app. This router is used for the edit page of a contact list we are developing. It displays the ID of the current contact being edited in the search bar. The problem arises whe ...
Currently, I am following a guide found at this link, and everything is working smoothly except when I encounter an error on the login screen: ..... 7| >> 8| <% if (message != null) { %> 9| <%= message %> 10| <% } %> 11| message is not defined ...
I am currently utilizing a for loop in JavaScript to display all the users from the database using ejs. I have included the code snippet below. This is within an express/node js application where SQL is used for data storage. <div class = "Contacts ...
I need to display my index page and automatically scroll down to the form section. One way I thought of doing this is by: app.post('/rsvp', (req, res) => { res.render('index/#rsvp', { errors: { email: 'Your email has already been registered'}}) } Th ...
I need to populate my database array results on the frontend using EJS. The code snippet I'm using is as follows: var tags = ["<%tags%>"] <% for(var i=0; i<tags.length; i++) { %> <a href='<%= tags[i] %>'> &l ...
Trying to include the author's username in reviews within an ejs template for my app. The following code snippet: <%= review.author %> is functioning correctly and displays: { _id: 5eff6793e7f26811e848ceb1, username: 'mike', __v: 0 } However, wh ...
Currently, I am implementing user authentication in Node Express with EJS using JWT. The generated token is stored in cookies using the following code: res.cookie('authorization', token, {maxAge: 3 * 60 * 60 * 1000}); During verification, I can ...
This is the main index.js file that serves as the entry point for my Node.js application. const express = require('express'); const app = express(); const path = require('path'); const port = process.env.PORT || 2000; require('./db/connection'); const Logi ...
Having some trouble with uploading posted data to Mongo in NodeJS. When I try the following code: var itemOne = steTodo({task: 'something', date: 'something', status: 'something' }).save(function(err) { if(err) throw err; console.log('It ...
I'm currently working on a project that involves fetching data from an API using a simple JavaScript file upon clicking a button. Initially, everything was functioning properly when both the HTML file and JS file were in the same folder, and I could acce ...
I am currently working with three schemas: const journalSchema = new mongoose.Schema({ title: String, category: String, subcategory: String, review: [{type: mongoose.Schema.Types.ObjectId, ref: 'Review'}], link: String, description: String, s ...
I am in the process of building a website navbar and I am curious about how to automatically inject code from one ejs file into another ejs file. In Python's Flask framework, this is accomplished using the principle of {% block title%} and in another fil ...
This is the concept behind my current design. Click here to view the design When making a GET request, I retrieve data from a MongoDB database and display it on the view. Now, I aim to implement a filter functionality based on user input through a form. ...
I have a vision for an app that allows users to tag their content using Node and MongoDB. Progressing, I successfully managed to store the tags in the database as an array: "tags": [ "laughing", "smile" ] However, I encountered an issue while tr ...
I'm currently working on a basic login page using express.js + E.js. If the login credentials are incorrect, I have a variable badLogin that is triggered (see below). However, my goal is to redirect the website back to the login page instead of remai ...
I'm currently developing a game server that involves players entering a game room and getting paired with another player. One feature I would like to implement is displaying the game board without having to reload the page in order to avoid reinitiali ...
Hey there! I'm new to Nodejs and currently experimenting with it. I've been trying to convert some of my basic Python codes to JavaScript. In one of my projects, I am sending a get request to the YouTube API and receiving 50 results in JSON forma ...
Express static configuration: app.use(express.static(__dirname + "/public")); Directory Structure: --public --assets --js --[JavaScript scripts] --stylesheets --[CSS files] Defined Routes: const shopRoutes = require('./routes/shopRoutes' ...
My current computer science assignment involves visually representing the data transfer process between a frontend and backend. I don't need to show the full data, just the flow of chunks and how it navigates through protocols. Could someone please guide ...