Currently, I am facing an issue while working with express and Pug (Jade) to render a page as the get() function is returning as undefined along with warnings... I followed these steps: npm install express --save npm install pug --save Here's a sn ...
When utilizing Flask and Jinja2, I am able to achieve the following: <link href="{{ url_for('static', filename='css/bootstrap.css') }}" rel="stylesheet" type="text/css"/> <script src="{{ url_for('static', filename=&a ...
I am in need of help with implementing a functionality in my code that switches between successful operation alerts and error alerts with sweetalert2. Currently, only the error alerts are being displayed. I'm not sure where I'm going wrong. Here ...
I set up a few routes : var express = require('express'); var router = express.Router(); router.post('/isAccessible/:orgaId', function(req, res, next) { res.send("------ param = "+orgaId); }); module.exports = router; Next, in an ejs file : <sc ...
I am working on a front-end application using Angular and a back-end system powered by Express.js. My goal is to have notifications displayed on the front end based on meetings scheduled at specific times. For example: If there is a meeting scheduled f ...
I'm completely new to express.js and API calls, and I'm stuck trying to figure out why my server keeps crashing. It works fine the first time, rendering the page successfully, but then crashes with the error: TypeError: Cannot read property &apo ...
Currently, I am conducting some local experiments and have made changes to my hosts file. Here are the entries: 127.0.0.1 example.dev 127.0.0.1 www.example.dev 127.0.0.1 api.example.dev Below is the code I am using: var subdomain = req ...
Recently, I updated my application to Angular 6 + Universal and it has been a positive experience overall. However, there are two specific issues that I am currently facing. I would greatly appreciate assistance in resolving both problems: 1- Is there a w ...
I'm currently working on a small node application and my goal is to have it create a cookie for every visitor, named 'session', which will store the session ID. However, I've been facing some challenges in getting node to generate this cookie using the coo ...
I have developed an application using Node JS, and I've taken it as far as I can on my local machine. Now, I need to deploy it on Heroku. If you want to check out the main server.js file, you can find it here: http://pastebin.com/6VGk8ESz. To understand h ...
I have successfully integrated passport with a JWT strategy, and it is functioning well. My jwt-protected routes are structured like this... app.get('/thingThatRequiresLogin/:id', passport.authenticate('jwt', { session: false }), thingThatRequiresLogin.fi ...
I am currently working on a function in my project that uses the async series method to ensure specific tasks are executed in a certain order. In this case, function1 needs to be completed before function2, which must then be completed before function3. a ...
I have been trying to utilize the renderToPipeableStream function from React18, and although it is functional, I am struggling with handling the pipe properly. The key section of my code involves an array of strings representing HTML. I am splitting the s ...
I have been working on a function to query my database and retrieve specific details for the selected item. While it successfully finds the items, it seems to be returning undefined. var recipefunc = function(name) { Item.find({name: name}, function ...
My NodeJS/Express application utilizes Handlebars for templates, and everything works smoothly except when attempting to display data retrieved from an Express API. The data is successfully fetched and can be viewed in the Chrome debugger. In the problem ...
I am currently following a Node.js tutorial by Mosh and I'm having trouble getting this line of code to work: DEBUG=app:db nodemon index.js When I try to run it, I encounter the error message: 'DEBUG' is not recognized as an internal or external ...
Exploring the ideal hybrid folder structure to meet our needs is my current project. After sifting through numerous resources and sources, I stumbled upon a folder labeled helpers housing files with a .js extension. |-- app | |-- controllers | | `- ...
I currently have a mobile app developed using the MERN stack that utilizes passportjs for user authentication and login (linked to a mongodb database via axios). However, I am facing an issue where I cannot associate the data/log entered by the user with t ...
Having resolved previous issues, my focus now is on populating the user document with posts. Here is the current structure of the user document: { "posts": [], "_id": "5e75cf827ef14514f69c6714", "username": "di ...
When it comes to performing a join-like operation, both GraphQL and Mongoose can be utilized for achieving the desired outcome. Before posing any inquiries, consider the following example related to Task/Activities (please note that this code is purely fo ...
Recently, I've been experimenting with node.js, express, and jade. I am attempting to create a select dropdown in a jade template like this: my-options = {"this": "something", "that": "something else", "those": "more stuff", "these": "also included"} for ...
I am currently working with the route provided below. The route functions properly when I manually add documents in MongoDB. However, I am interested in implementing a feature to handle scenarios where the user is not found, created, and then automatically ...
As a newcomer to the world of Express and Node.js, I am eager to understand how to display multiple SQL results on different elements of a web page. Though it may be a simple question for some, I am unsure how to proceed and would greatly appreciate any g ...
var express = require("express"); var app = express(); var bodyParser = require('body-parser'); var port = 3000; const fs = require('fs'); // establishing connection to MongoDB using Mongoose var mongoose = require("mongoose"); // Implementing bodyParser ...
I am currently working on a project that involves tracking all socket.io notification transactions initiated by the server, resembling an API request/response counter to validate subscription validation. Our team is utilizing an express middleware to moni ...
Recently, I followed a tutorial on setting up Node.js with Nginx on two Ubuntu 14.04 servers connected via private networking. The setup involves having Node.js running on myappserver (accessible via private IP myprivatewebserver and publicly via mypublica ...
I am managing three services - be, fe, and auth. These services are all hosted on App Engine with a load balancer set up to keep them under the same domain. My goal is to create a session upon user login. The issue I'm facing is that even though the set-co ...
Encountering issues displaying data from my local express.js REST API, organized as follows: people: [{ surname: 'testsurname', name: 'testname', email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemai ...
I've developed a backend server using NodeJS with Express. On the frontend side, I'm working with the latest version of Angular. When I post data (GPG file) to the NodeJS server and try to retrieve it in my NodeJS code to output it on the server console, ...
Currently, I am in the process of constructing a basic blog using Express 4.13.3 and Mongoose 4.2.4, however; there is an issue that I have encountered where subsequent routes continue to match even after one route has been matched, leading to the applicat ...
Imagine you have the following setup for an Express app: const express = require('express') const app = express() app.use((req, res, next) => { console.log('\n\nALWAYS') next() }) app.get('/a', (req, res) ...
I am facing an issue with making a fetch request when trying to add additional path or parameters... Here is what I want to achieve: const fetchOwnerCardList = () => { fetch("http://localhost:5000/api/card/ownerCards", { method: "GET", header ...
I'm currently working on a Telegram bot and I need to retrieve the chat invite link when a member joins a group. I've been using the node telegram bot API in NodeJS and following the "chatMemberUpdated" method as outlined in the official Telegram ...
I recently implemented a function that takes a middleware function, wraps it in a try-catch block, and then returns the modified middleware function. tryCatch.ts import { Request, Response, NextFunction } from "express"; export default function ...
I am currently developing an authentication application using Node.js, MongoDB, and the Passport-JWT middleware. I have successfully implemented the login functionality and I am able to obtain a token. However, when trying to access the user profile after ...
I am faced with a challenge regarding accessing the 'data' sent from my backend server in my frontend js. Can anyone guide me on how to achieve this? Express ... app.get("/", (req, res) => { res.render("home", {data} ); }); ... home.ejs ... <sc ...
Can someone help me with using the errorMessage object from routes in a partial? I have attempted to implement it as shown below: Route:- const express = require("express"); const router = express.Router(); const Character = require("../models/character" ...
I've been searching through the official documentation, but I couldn't find a list of events for express. Does anyone know if there's something like 'route-matched' so that I can use app.on('route-matched', () => {})? Edit: I did come across the mount ...
Currently, I am utilizing mongodb on ubuntu 14.04 and executed a command to include a user in a database with readWrite permissions using the subsequent command - mongo Afterwards running use utthan-dev and then executing the following: db.createUser( ...
Can anyone help me understand how to import the user.json json file into my user.js? I want the json file to be displayed when typing /user but I'm struggling with the new version of Node. index.js import express from 'express'; import bodyParser from 'bo ...
Hello everyone, I am just getting started with the MEAN stack and I'm looking to add a file upload feature to my project that will store uploaded files in a MongoDB database. Since my images are small, I don't think I need to use gridFS from MongoDB. Can a ...
Currently, I am operating an express application and there is a specific section where I need to send some data along with the page being served. The file is being sent using the res.sendFile() function. Ideally, I would like this data to be passed in the ...
I'm encountering an issue in this nodejs and expressJs project where I am unable to successfully retrieve data from one function. router.get('/', async(req, res) => { const meta = fetchMeta(); console.log('meta', meta) // ...
IMPORTANT NOTE: If you are experiencing issues with nested requests or responses, make sure to check the parameter order or utilize the express.router({mergeParams: true}) option. It seems like my requests are being encapsulated by an additional object re ...
Recently, I've been experimenting with developing a basic app using nodejs, socket.io, and sqlite as the database system. This project is primarily for learning purposes to gain a better understanding of how nodejs functions and to determine its suita ...
I'm currently delving into the world of Express in conjunction with Mongoose. I encountered an issue while working on a page that involves running a forEach loop on a list of "campgrounds" fetched from a MongoDB. From what I understand, when using the .fin ...
I'm encountering an issue connecting my front-end JavaScript to my back-end Node/Express. Although the requests from my client-side js to the server return successful, the page I am requesting fails to render. On the server side, here is my code: app.get ...
I've been attempting to create CSRF tokens in my Express application. Despite looking at similar questions, I haven't found a solution. Below is the code snippet from my app.js file: var app = express(); var connect = require('connect' ...
My current setup involves a unique configuration that I'll need to maintain until I have the opportunity to refactor the project later this year. Right now, it's a static index.html landing page being served with a root location "/" by NGINX. I& ...
After attempting to install type definitions using: The javascript file where my code is located is server.js. npm install @types/express Unfortunately, I am still not receiving intellisense for the 'app' variable after initializing express. ...
Recently, I started working with node.js and using MEAN stack for my project. In the footer of my project, I have an option to "Subscribe email". Due to constraints in the architecture, I am unable to utilize Angular for displaying flash messages as I don' ...
Currently, I have set up a node server with express on top. My domain registrar is GoDaddy. When trying to connect using www.example.com, it doesn't work, but it works fine with https://www.example.com. Below is the code snippet for reference: app.use(ex ...
Currently developing a project using React, Babel, and Webpack on the front end. Need to find a secure way to store and access API keys for the project. Considering storing API keys in the .env file, which is listed in .gitignore to keep it private. Howe ...
Currently I am using hbs as my template engine in express.js. The handlebars-helpers library from assemble is something that I find extremely useful. However, I am unsure about how to integrate this library into my project. I have also been unable to loca ...
Trying my hand at building an application using Node and Express has been smooth sailing until today when I encountered this error: { code: "PROTOCOL_ENQUEUE_AFTER_FATAL_ERROR", fatal: false } According to Google, I should switch from create ...
I'm curious if my class is shared across instances: for example, I have a route that looks like this: /student/:id When this route triggers the controller (simplified version): module.exports = RecalculateStudents; const recalculateActiveStudents = r ...
Currently, I am in the process of creating a simple quiz application. While working on this project, I encountered an issue with linking a JS file in an HTML template. Even though I have confirmed that the path is correct, every time I run my node app, the ...
I've recently started exploring NodeJS Express and came across the official tutorial from express-ws for setting up websockets in a simple project generated using npx express-generator. While following the tutorial, I noticed that in the app.js file, ...
Recently, I implemented a password reset feature using NodeJS/Passport. I found an excellent guide: . I followed the instructions and it was mostly successful. However, there seems to be a critical error that I can't locate. When a user goes through the pr ...
Here's my query: I am interested in learning Node.js/Express and creating a basic web project. The project would involve setting up a database with tables for users, video games, and categories. The website will simply display a list of games (for demonst ...
Is there a way to make cookies never expire for express-session? If not, what is the maximum maxAge allowed? I came across some outdated information on setting cookie expiration on SO (over 10 years old) and here on express, which mentions a maxAge of 1 y ...
Utilizing express-session in my NodeJS application for managing sessions, express-mysql-session to store session data in MariaDB, Passport for authentication, and Sequelize for ORM. Encountering an issue where I am unsure how to refresh a user's session a ...
Currently, I am in the process of developing a GraphQL mutation for updating user account details within my application. These account details include fields for gender and birthday, both of which are optional. Here is an example of my InputType: @InputTyp ...
Currently, I am learning about JSON tokens through a tutorial and encountering an error. Previously, everything was functioning correctly with sessions, but now I can't seem to pinpoint the problem even though I'm using identical code. This snip ...
While there are numerous solutions available for handling the Summernote file-upload in PHP, I have struggled to find a satisfactory solution for Node.js. Here is My JavaScript: $(document).ready(function() { // $('#summernote').summernote( ...
I'm facing an issue with the delete functionality in my API. In order to use my application, a user must log in and then they can add courses. These courses are stored in a nested array within the User model. I want users to be able to remove (delete) ...
I've been struggling to configure a full stack app using create-react-app with Express and TypeScript. My main issue is figuring out how to compile the server files into a build folder. I have separate tsconfig files for the server and create-react-app. T ...
When building my website using Express, I encountered an issue with my code in server.js: app.use(express.static('public')); app.get('/add', function (req, res) { res.sendFile(__dirname + "/" + "add.htm");}) The structure of my projec ...
Dealing with the issue Hello everyone. I've been struggling for the past 30 minutes trying to figure out the rendering method problem I'm facing. Whenever I try to post data through a form from Page A and then render that data on Page B, I keep encounteri ...
Despite my best efforts, I keep encountering this persistent error on Heroku whenever I attempt to serve a static HTML page with some basic JS, images, and CSS. I diligently followed all the advice from SO, made adjustments to index.js, restructured files, ...
Is there a way to save files in mongoose? For instance, let's say I have a route for the POST method at /, and for the GET method at /. When posting to /, the goal is to save the uploaded file to a MongoDB database using mongoose. Then, when someone t ...
I am currently working on a project to create a website that integrates the google books API for users to search for books. To start, I have set up a server using express in index.js at the root of the project directory, and all my static files are stored ...
After successfully deploying my website for the first time, I encountered an issue with data not being properly sent from the contact form to our node.js server and then to our email address via nodemailer. The error message "Access to XMLHttpRequest at 'h ...
I recently had a javascript code that I'm now attempting to convert into typescript route.get('/order', async(req,res) => { var sessionData = req.session; if(typeof sessionData.user === 'undefined') { ...
I've encountered a problem even though I believe I'm following all the right steps. I'm attempting to save an item from a form into my mongodb collection using mongoose. This is what my schema looks like: // stationmodel.js export const Sta ...