I've been experimenting with the mongo-morgan package. I have been using it in a similar manner to the original morgan package, but I am not seeing any output in my terminal logs. I attempted the following (replacing 'url' with my actual database URL): a ...
Outside of regular operating hours, the database transitions into an Idle state. To re-establish connection to the data, I am using the code snippet below, var mysql = require('mysql'); var settings = require('./config.js'); var conne ...
I successfully deployed my project on Heroku. My server is built with Node.js + Express and the client uses ReactJS. To render the ReactJS page, I have included the following code: if (process.env.NODE_ENV === "production") { app.use(express.sta ...
Seeking guidance here. Currently, I am working on a Node.js and MongoDB application related to Apartment ownership. Within this application, there are two main datasets: Ownership and Tenants. For instance, Mr. A owns units 10 and 11. Then we have Mr. C wh ...
My website is encountering an issue where the CSS fails to load, and I am receiving the following error message: Refused to apply style from 'http://localhost:5000/server/nodeClient/public/css' because its MIME type ('text/html') is not a supported stylesh ...
My question is quite simple. I am using Node.js with Underscore as the templating engine, all within the Expressjs framework. I am attempting to create partials similar to other programming languages: <% include('header') %> <body id ...
NOTE: It seems that my issue lies in the distinction between app.use() and app.get(), rather than the middleware express.static(). I found a solution to this problem which explains it much better than the express API documentation: Difference between app. ...
I've encountered an error while attempting to launch my express server, and despite my best efforts, I can't seem to figure out the cause. It was operational for a period of time before suddenly ceasing function, though I'm unable to pinpoint any changes t ...
Despite reading similar inquiries and solutions, I am still unable to find a fix for my issue. Below is the content of my app.js: var express = require('express'); var app = express(); app.all(function(req, res, next){ if((!req. ...
Is there a way to retrieve the uploaded binary file data from the browser? While the Nest.js server application functions correctly with Postman, it throws a 400 error when the request is sent from the Google Chrome/Angular application. Any ideas on how ...
I am currently working on developing a tool to replicate scenarios involving slow webservers. Inspiration behind creating a mock server Our frontend application communicates with 3 different webservers - X, Y, and Z all under the same domain. For example, ...
const express = require('express'); const app = express(); Behold, the birth of an express application. But wait, what is this 'express()' exactly? A method or a constructor perhaps? And where does it originate from? ...
Presently, I am in the process of developing an API that is designed to update the current user in mongoDB based on the data provided in the request. However, whenever I execute findOneAndUpdate(), I encounter a 500 internal server error. (I will outline ...
I am working on a React app that communicates with an API using Express. Currently, I am using the GET method to fetch data from a database, and my fetching code looks like this: const posts = []; fetch(URL) .then(response => response.json()) .then(jso ...
Working on my express website and encountered some warnings: npm WARN deprecated <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d575c59587d0c130c0c130d">[email protected]</a>: Jade is now pug, please update to th ...
I have a collection of article previews sourced from a database and rendered on the webpage using a Pug.js mixin. each article in articles +articlePreview(article.title, article.text, article.imgSrc) To enhance the user experience, I want to implem ...
My current setup involves using NVM to bypass the need for utilizing sudo when installing global packages. This method successfully handles installations of tools like Bower and Grunt, but hits a snag when attempting to install Express Generator globally u ...
I am currently in the process of developing an application specifically designed for iPad users. To create this app, I am utilizing Express and a restful approach as the backend framework. The code snippet below demonstrates how Express should respond on t ...
Utilizing async/await, I aim to showcase the data obtained from a readable stream prior to displaying the corresponding message. Below is my code snippet: var stream = async function (){ var myStream = fs.createReadStream(__dirname+"/someText ...
Is there a way to dynamically switch the database configuration for my pool in Node/Express application? I am using a REST API with node/express and have multiple databases. What I need is for the API to select the appropriate database based on the user.c ...
As I delve into the world of Node and Express, I've come across multiple methods for initializing an application. Specifically, I've been working on a project called "nodetest" and here are the initial steps I took: Firstly, I installed express ...
My goal is to streamline my routing process with AngularJS without having to duplicate route specifications in both Express and Angular. To achieve this, I set up a "catch all" route as shown below: app.use('/api', api); // handling server-side functional ...
Before when I was using v11.x.x, my dashboard.js had a section that looked like this: const perms = Discord.EvaluatedPermissions; renderTemplate(res, req, "dashboard.ejs", {perms}); However, after updating the bot to discord.js v12, 'perms' is no ...
For my backend, I am using node js, express, and postgresql. Here is the approach I took to create a rest API: exports.schema = function (inputs, res) { var query = knex('schema') .orderBy('sch_title', 'asc') .select(); query.exec(function (e ...
Currently, I have a node/express/passport backend running on port 3001 that I am accessing directly from the browser for authentication purposes. It successfully authenticates and manages access to protected URLs. The frontend is built using Polymer and is ...
**Edit: Re-created with a simple example that works first: I have an example file and two modules. moduleA has a dependency called moduleB // moduleA.js const ModuleB = require('./moduleB'); function functionA() { return 20 + ModuleB.functionB(); }; ...
Seeking Assistance! I recently deployed my nodejs backend app on Heroku, which involves a functionality where users can upload documents in jpg, jpeg, or png format. These documents are stored in the static folder (/assets/docs). Before pushing the updated ...
When running this code in the VS Code terminal, be sure to verify any errors that may occur. var express = require('express'); var app = express(); app.get('/', function(request, response) { response.send("hello world"); }); app.listen(3000, () => ...
Running my E-commerce store on Magento, I encountered an issue with Paypal Express checkout. After selecting Paypal as the payment option and logging in on the Paypal platform to confirm the payment, I was redirected back to my Magento shop's review page ...
My schema hierarchy is...... List -> Items -> (attachments, comments, labels) Question: If I need to delete a list, all related hierarchical elements must be removed. Here (attachments, comments, labels) are linked to Item and Item is linked to List ...
When it comes to logging users into my application, I am utilizing passport-local. The login process involves a function called in my AngularJS controller: $http.post('/login', $scope.user).then(function (response){ if(response.data.success){ ...
I've been working on saving an object into a Mongoose DB, and everything seems correct. However, I keep encountering a Http failure response for http://localhost:3000/api/stuff: 400 Bad Request error in my browser that I can't figure out. This er ...
After several attempts to use fetch for retrieving JSON data from my express server, I have encountered some issues. While the fetch function works well with JSONPlaceholder, it seems to fail when accessing my express code. Below is the snippet of my fetc ...
I have saved JSON data in a database under the accessPoint field, and it appears like this: {"mode": "client", "rate": 0, "ssid": "RMG", "signal": 0, "channel": 0, "password": "", "username": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" ...
I recently installed the express-validator package to help me sanitize form fields. However, when I tried using it, I encountered an error: TypeError: req.sanitize is not a function. var express = require('express'); var router = express.Router(); router. ...
I am facing a roadblock at the moment. I have a form that is used for writing blog posts and I was previously using multer to upload images to mongodb as a datastream. However, due to scalability issues, I decided to switch to uploading images to S3 but I' ...
Is there a way to retrieve information about the currently authenticated user in Node.js (specifically Express.js), similar to using Auth::user() in Laravel framework? Appreciate any guidance on this. Thank you. ...
 I am working on developing a node.js express application and I require the ability to access two different sets of credentials depending on the user’s context. Currently, I have configured the app to retrieve one set of credentials from a specific co ...
My expertise lies in creating API, BackEnd, and Frontend websites. For the API, I utilize Express, while for the BackEnd - FrontEnd, I rely on ReactJs. During local testing, everything functions as expected. However, upon deployment to the server, error ...
I have a server running Nginx with the following setup: server { listen 80; server_name example.ca www.example.ca; location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header ...
Struggling with setting up React for server-side rendering. Here are the files related to my issue: I've been following online tutorials and trying to create a React Component, but I'm confused about using react.createElement() on the component ...
Forgive me if this is a silly question, but I'm considering removing the async function below since there are no await's. This code is part of a large production system, and I'm unsure if removing async could have unexpected consequences? (a ...
Objectives: The goal is to execute code after the response has been completely processed and successfully sent out. After consulting the documentation, I attempted the following approach: @Injectable() export class LoggingInterceptor implements NestInterc ...
Is there a way to pass multiple values, such as a collection, for a specific query key in express? I vaguely remember seeing something like this on the internet: http://<somehost>/<somepath>?id[]=10&id[]=11&id[]=12 I know that Ruby o ...
While using mwbot on node, I encountered the following error: response: { login: { result: 'Aborted', reason: 'Cannot log in when using MediaWiki\\Session\\BotPasswordSessionProvider sessions' } } ...
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 ...
Struggling to make socket.io function properly on Heroku, encountering issues with code inconsistency between development and deployment. The problem persists even after uploading to Heroku: 1. No unusual activity in the logs. 2. Data saved to the databa ...
Does anyone have experience building a simple To-Do application using node js, express, mongodb, and ejs? I'm encountering an issue where although I can successfully save todos to my Mongo Compass database, they do not display on the screen as expect ...
Currently, I'm in the process of building a Node.js Application using Angular.js and Express.js. My goal right now is to populate a list with customer names and addresses by using this code snippet: var mylist = new generic.list(); mylist.add({name:"Roh ...
Currently, I am utilizing the express-fileupload npm package to handle multipart file uploads. The challenge I am facing is the need to upload multiple files where the size exceeds the default limit of 100kb. In order to accommodate larger file sizes, I ha ...
As a beginner in javascript, I wanted to confirm if my code is appropriate. I am currently using JavaScript to handle a PUT request. My main goal is to return the updated Sequelize model as a response and then redirect the user back to the local /. Can I ...
Is there a new way to run an Express 4 app with Forever, or should I stick with the current package? Currently, I am using Forever to run my Express 3 apps. I have installed it locally using the package manager and execute the following command: forever ...
I am working on a website that allows clients to make their site go live by setting var live = true;. Once this variable is set, certain webpages will display. I would prefer not to store the live variable in a database as creating a collection solely fo ...
While I've come across other solutions to this problem, they all seem to have drawbacks. One option leads to a redirect, which could be disastrous for my front-end application that relies on Mixpanel. A double-load of Mixpanel results in a Maximum Ca ...
view the error image I am currently in the process of developing an NFT search application that is capable of locating the NFTs associated with a specific wallet address. However, I am faced with the challenge of using Alchemy without exposing the API key ...
My data structure functions correctly when I use console.log: console.log(JSON.parse([values.category2]).needed_skills); However, when I pass the output of JSON.parse([values.category2]).needed_skills to a component in my application, the entire system c ...
I have been working on a MEAN stack application and I have set up a proxy configuration for development purposes. Everything seems to be in order as I am able to successfully call an API from Angular/Node. However, the issue arises when I refresh the brows ...
Looking for some guidance as a beginner trying to create and run a nodejs application. Encountering an error while running server.js via nodemon, the console displays the following: Express server listening on port 3000 Mongoose default connection open t ...
Within my ajax request, I am encountering the following code: 403: function(jqXHR) { var error = jqXHR.responseText; console.log(error); } When this error occurs, a message is displayed in the console: Htt ...
Currently, I am facing an issue while attempting to implement an auto-increment ID field for a person collection in a MongoDB cloud database. The error arises at the line containing const schemaKey = this._schema.path(this._options.inc_field); when I inclu ...
Can you re-use an existing exec mongodb/mongoose query in nodejs? For example, let's say I create a query like this to check if a user exists: const inviter = await User.findOne({ _id: req.userData._id }).exec() // There is more code below before updating ...
I'm having an issue with my Node.js Express project where I keep getting a 'Cannot GET /' error on Localhost. Below is the content of my server.js file: console.clear(); const express = require("express"); const app = express(); c ...
app.get('/game/', function(req, res) { if (req.session.user) { app.use(express.static(__dirname + '/game')); res.sendFile(__dirname + '/game/index.html'); } else { res.send('not logged in '); } }) I'm curious whether it's considered l ...
I am new to web development and struggling to understand how to transfer data from the Node server to the client while also displaying an HTML page. I am aware that res.send() is used to send data, but I'm having difficulty maintaining the client display a ...
I'm having issues with my code where it's only returning an empty array when I try to fetch documents from the "Ingredients" collection. Here is a link to my "Ingredients" collection image: https://i.stack.imgur.com/Gpw8V.png Below is the ingredient mode ...
After reviewing the code below, I encountered an issue: var email = req.body.correo; var pass = req.body.pass; var firebase = require("firebase-admin"); var serviceAccount = require("./prueba-064cb79dba28.json"); firebase.initializeApp({ credential: fire ...
Currently, I'm seeking alternatives to using callbacks for my mongodb queries. I've been utilizing mongoskin for making calls like this: req.db.collection('users').find().toArray(function (err, doc) { res.json(doc); }); As I often need to execute multi ...
[Summarized] Focus on the bold parts. Although I am relatively new to Node.JS, I have been able to successfully build some projects. However, I have come across a burning question that has left me frustrated after searching Google for answers without much ...
I am currently working with Express.js and facing a challenge in retrieving form data from a dropdown select element. I attempted to use body-parser, but unfortunately, when I try to access the data using eq.body.method_select, it returns as undefined. I h ...
When a user sends a request to my API with a payload that exceeds the set limit, I want to catch the error thrown by the server and handle it on my own so that I can provide a more detailed JSON response to the client. Currently, I am utilizing the Expres ...
const express = require('express'); const upload = require("express-fileupload"); const editJsonFile = require("edit-json-file"); const fs = require('fs'); const app = express(); app.use(upload()) app.use(express.url ...
I am currently working on node.js and express. After attempting to establish a simple server, I am encountering an unexpected response error. const http = require('http'); const myServer = http.createServer(function(req, res){ res.writeHead ...
I'm currently working on a tutorial to develop a comprehensive REST API. In the process, I've created a TypeScript class that exports a new Express router: import { Router, Request, Response, NextFunction } from 'express'; export clas ...
I am currently in the process of developing a simplistic fictional sneaker application with the MERN stack. While I wouldn't classify myself as a beginner, I'm also not an expert. I successfully created the backend and generated a json rest-api. ...
Need help with using 2 parameters in 1 route (get)? Check out my code below: router.get('/', function (request, response) { Result.find(function(error, results){ if (error) console.log(error) response.render('index', {results:resul ...