I have a basic loop with a function that returns a Promise. Here's what it looks like: for (let i = 0; i < categories.length; i++) { parseCategory(categories[i]).then(function() { // now move on to the next category }) } Is there ...
Operating System: Window 11 NPM version: 8.1.0 I am not using any proxy or antivirus software. Despite trying several solutions and changing registry settings, I still encounter an error when attempting to install a package using npm. I have even reinsta ...
Hey everyone, I could really use some help. I've finished all the coding part of my project but when I try npm start at the end, I keep getting errors. Error: npm ERR! code ENOENT npm ERR! syscall open npm ERR! path C:UsersyateeshDownloadsgrpchat/pac ...
I am working on a basic REST API using Typescript, Koa, and Sequelize. If the client sends an invalid PUT request with empty fields for "title" or "author", it currently returns a 500 error. I would prefer to respond with a '400 Bad Request' ins ...
I'm currently in the process of building a website, but when I try to render an ejs file (index.ejs), only the HTML portion is displayed without showing any stylesheets, fonts, or images. Here is the code snippet for linking the stylesheets: <!D ...
Currently, I am facing a challenge while trying to enhance my npm bundle script. Although the initial part is functioning smoothly, I am encountering difficulties in including three additional files along with the bundle. At present, my script looks like ...
Currently, I am working with node.js using expressjs. My goal is to store an account in the session. To test this out, I decided to experiment with sessions by following the code provided on expressjs var RedisStore = require('connect-redis')(ex ...
I've been exploring the possibilities of using nested routes for their easy way of passing variables. router.post('/postlinkone', function(req, res, next){ //define a few variables (x,y) //render or redirect to close this route router.post('/postlink ...
After finally migrating my existing Angular project from v8 to v13.0.0, I decided to incorporate SSR into it. The process of updating the project itself was time-consuming and challenging. Once the app successfully ran on v13.0.0, I attempted to add SSR b ...
I have a package.js file where I currently depend on fluent-ffmpeg like this: Npm.depends({ "fluent-ffmpeg": "1.5.2", }); However, I now require the latest version of that library from the master branch in order to access a bug fix that hasn't bee ...
Currently, I am in the process of constructing a website and have implemented an express.js server to collect data submitted through a form. Prior to configuring the server, I had already developed the site using static js and css files. Once the connectio ...
For the past 4 hours, I've been struggling to parse a basic JSON from Twilio. The process is as follows: A text message containing a magnet link is sent Twilio forwards the request to my serverless function in the cloud I attempt to parse the reques ...
Currently, I am using Selenium ChromeDriver, Node.js, and Mocha for testing purposes... I am facing a dilemma at the moment: The driver.wait function seamlessly integrates with until. I have a promise, which we'll refer to as promiseA. This pro ...
As I attempt to set up Windows-Build-Tools for my Electron project using NPM, I encounter an issue. When I execute npm install --global --production windows-build-tools, I receive the following error: Downloading python-2.7.15.amd64.msi Error: getaddrinfo ...
I am working with a business level database module named "db_location" that utilizes the node-fetch module to retrieve data from a remote server through REST API. **db_location.js** DB LOGIC const p_conf = require('../parse_config'); const db_location = ...
I am currently facing an issue with creating and then deleting an SQLite database using the before and after Mocha hooks. When utilizing the Node.js SQLite library, I encounter an 'Error: EBUSY: resource busy or locked...' message upon calling fs.unlinkSyn ...
namish@namishs-mbp ~ % npm install npm encountered some warnings during the installation process: - ENOENT: no such file or directory, open '/Users/namish/package.json' - No description - No repository field - No README data - No license field S ...
I'm relatively new to working with node and I'm attempting to develop a function that retrieves server information. However, I've encountered an issue. I've set up a config object (which will eventually be dynamically updated by certain events) and later o ...
When working with a Node.js package that is missing the node_modules folder, running the npm update command will generate and populate the necessary node_modules folder. However, there are some things that I find confusing: Why does it add packages tha ...
Beginning with Node v8.5.0, the support for ES6 style modules has been introduced. import x from 'x' You can access this feature by running node using the --experimental-modules option, like so: node --experimental-modules test.mjs By utilizi ...
I currently hold an HTML file within my local file system, presented as follows: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example of a Minimal Working File</title> ...
In my app development process, I am working on a feature where a user is chosen and given a 15-second timer to respond. The app queries the database every 5 seconds to check if that specific user has been chosen. However, there's an issue with the synchron ...
Having an issue with storing MongoDB data in a variable to display in HTML using hbs. The specific error message is TypeError: Cannot read property 'collection' of undefined. Here's the code snippet I have written: const express = require('express'); cons ...
I'm currently working on developing a bot with the ability to selectively remove embeds from certain messages or links shared by specific users and bots within the server. For instance, if someone posts a tweet and I don't want to see the Twitter embed, m ...
In my code, I am utilizing the Node Events module to execute a function asynchronously. var events = require('events'); var eventEmitter = new events.EventEmitter(); eventEmitter.on('myEvent', f2); function f1(x, y) { console.log('received', x, y) ...
I am currently working on a feature that will allow users to save and download static files, but I want these files to only be accessible to logged in (authorized) users. routes/files.js var express = require('express'); var router = express.Router(); /* ...
Within my Express app, the initial landing page prompts visitors to input their email address and then choose between "Sign Up" or "Log In", depending on whether they have an existing account. Following this input, users are directed to either "/signup" o ...
Before delving into the question at hand, I just wanted to confirm something. When I instantiate Express with const app = express(), is app an instance of the entire Express module? I ask because when I call app.route, is route an Express method or a NodeJ ...
I'm currently delving into the protobuf protocol and I've encountered an issue where the server (node js) and client (python) are experiencing difficulties exchanging messages. However, there seems to be no problem when it comes to communication between th ...
How can I retrieve URL query parameters in Node.js using TypeScript? Below is my attempted code: /** * My Server app */ import * as Http from "http"; import * as url from "url"; import { HttpServer } from "./HttpServer"; import { TaxCalculator } from ". ...
I have created a Comment Model with specific fields including userId, contentId, repliedTo, and text. The schema for the Comment Model is defined as follows: const CommentSchema = mongoose.Schema({ userId: { type: mongoose.Schema.Types.ObjectId ...
While working on the server side, I am attempting to update a field within my Mongo collection using a callback function as a parameter in a setTimeout function in Meteor. The goal is to create a function that runs at regular intervals to clean up the data ...
Can we customize queries based on optional routes? app.get('/:category/:item?', function (req, res) { var category = req.params.category; var item = req.params.item; var sqlQuery = 'SELECT * FROM items WHERE category = ? AND item = ?&a ...
I am currently working on implementing the passport module in my application. After reading some manuals, I found this: app.use(passport.initialize()); app.use(passport.session()); Can someone explain what app.use(passport.initialize()) does exactly? I ...
My Collection is structured as follows: { id: 23423-dsfsdf-32423, name: Proj1, services: [ { id:sdfs-24423-sdf, name:P1_Service1, products:[{},{},{}] }, { id:sdfs-24jhh ...
After creating a basic Node/Express App, I'm currently working on organizing routes based on the separation of logic into different files. In Server.js var app = express(); var router = express.Router(); require('./app/routes/users')(rout ...
I'm trying to compare elements in two arrays and see if there are any matches. However, I can't seem to get it working correctly. let name; let list = ["Kat", "Jane", "Jack"]; // sample array let input = ["Hey", "i'm", "Jack"]; if (input.fo ...
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 ...
Utilizing http://expressjs.com/ and https://github.com/request/request to create an API call and retrieve an XML response for the browser. However, instead of the body, it is returning the Header. var express = require('express'); var request = ...
I'm working with Google Cloud Functions that require a JSON key file. Here is an example: const SERVICE_ACCOUNT_EMAIL = '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="41382e34331e322433372822241e2022222e342f351e242 ...
I decided to dive into the express documentation and found a few lines that caught my attention. Check them out: // ./routes/test.js var router = require('express').Router(); router.param(['id', 'page'], function (req, r ...
I'm currently working on creating a Controller Class that will handle the initialization of all my routes using ExpressJS. Below is a simple example of what I have so far: class Test extends Controller { constructor(App) { const Routes = [ { ...
Every time I attempt to install a package using npm install, I encounter an error message (usually referring to a different path). I have attempted running npm cache clean, restarting my computer, and checking for any processes that may be interfering with ...
Is there a way to catch unhandled Promises Rejections using middleware in order to access the Request and Response objects of the request? I've written some code, but it seems that the middleware or process.on function is not being triggered when an u ...
This question is akin to a previous inquiry I made on Stack Overflow, but the situation here involves associating a "do not contact" list of WorkerSids with a Task for specific assignments. The objective is to prevent certain workers from being assigned ta ...
Looking to make changes to the user's name and value in JSON format: { "User": [ { "name": "John", "value": 1000000 } ] } ...
I am currently working with an SQL database that consists of two tables, namely club and players. These tables are connected through a one-to-many relationship. Although the query in my node.js code is functioning properly, I am facing an issue retrieving ...
I'm currently working on a Node.js project that utilizes the basic-auth package for implementing password protection. However, in my auth.js file, the same username and password are being used for all routes. I'm looking to modify this setup so that each r ...
I can't figure out how to resolve this ongoing issue... I've attempted uninstalling node entirely and then reinstalling, clearing the npm cache, reinstalling the packages (Angular CLI), using sudo chown -R franfonse ../Programming , but this prob ...
I am developing a login/sign up API using nodejs, express, and mysql. Despite receiving the "Successful Sign Up!" message without any errors during testing, the user table in the database remains empty. Below is the query I am attempting to execute: con. ...
I am trying to retrieve the most recent document from a collection using mongoose in conjunction with nodejs/expressjs. In addition, I am implementing server-side pagination which prohibits me from reversing the order of retrieval after fetching. exports. ...
With my file system becoming more complex, I decided to switch from using app.use(express.static()) to utilizing express.Router(). Initially, I thought I could just replace app.use(express.static()) with router.use(express.static()), but unfortunately, thi ...
My current project involves a website with a game client and a server that communicate via sockets. The issue I'm facing is how to set the socket url depending on whether the code is running on the server or my local PC. During testing and debugging, ...
return driver.executeScript("\ console.log('Error: Incorrect selection');\ $('option:selected', 'select[name='who']').removeAttr('selected');\ $('select[name='who'] ...
Here is my situation: When a user logs into the app and then opens another browser window, they are already authenticated thanks to express-session, bypassing the login page. This pattern continues for subsequent browser windows. The issue I am facing no ...
I have a string that I am sending from AngularJS to NodeJS in the following format. "{↵obj:{↵one:string,↵two:integer↵}↵}" //request object from browser console To convert this string into an object and access its properties, I am using the serv ...
After configuring my vscode launch.json file with the necessary breakpoints in my step definition and attempting to debug the test, I encountered an error that prevented the debugger from opening. The contents of my launch.js file are as follows: { " ...
view image details here After running npm install -g ts-node, I proceeded with npm install only to encounter an error that left me clueless. Subsequently, when attempting npm start, a series of errors related to the gulp server or similar issues emerged. ...
For my file copier desktop application built with node webkit, I aim to create a seamless flow where the initial check for existing profile data determines the first page displayed. The header with static links/buttons to various views remains consistent ...
https://www.youtube.com/watch?v=Fa4cRMaTDUI I am currently following a tutorial and attempting to replicate everything the author is doing. At 19:00 into the video, he sets up a project using vue.js and express.js. He begins by creating a folder named &apo ...
I'm having trouble with this SQL query that uses INNER JOIN. The query is returning an error. connection.query("SELECT caracavis.caracname FROM caracavis WHERE firstcaturl ='" + req.body[0].firstcatname + "' AND secondcaturl = '" + r ...
Having just started working with express, I find myself a bit confused about how to handle data on the front end. Take a look at the code snippet below: exports.init = function(req, res){ if (req.isAuthenticated()) { //res.send(); var userId = ...
While using socket.io, I encountered an issue where some users were unable to send messages with the message "I can't send a message why?". After researching the problem, it seems that the firewall or antivirus software may be blocking websockets. If ...
I set up a shared library using Visual Studio Enterprise 2015 Update 1 : File > New Project > Templates > Visual C++ > Cross Platform > Shared Library (Android, iOS) The default project structure was generated as follows: While the android ...
Recently, I encountered an audio file in stereo with a .raw extension that needs to be converted into mono using Node. Despite my efforts, I haven't been successful in finding examples or libraries outlining the process. Any assistance on this matter ...
My function extracts meta data such as width and height from a video element in the following code snippet: export async function getVideoMetadata( videoBlobUrl: string, videoElement: HTMLVideoElement, ): Promise<{ width: number; height: number }> ...
As a new socketIO user, I am working on a website with 2 game modes. Initially, my plan was to create separate scripts for each mode, but now I am considering consolidating everything into one script. Currently, my script emits data to all connected users, ...
When using the code snippet below, what will be the input to and output of .pipe(gulpIf('*.css', cssnano()))? gulp.task('useref', function(){ return gulp.src('app/*.html') .pipe(useref()) .pipe(gulpIf('*.js', uglify())) .pipe(gulpIf('*.css', ...
I have a React front end with Node backend and I'm using sequelize for mySQL. Within my database, there is a table called "company" with a column named "logo" where images are stored. How can I dynamically generate a URL for the img tag in order to di ...
I have an azure website with a URL like: . In my server.js file, I have the following code: var restify = require('restify'); function respond(req, res, next) { res.send('hello ' + req.params.name); next(); } var server = restify.createServer(); ser ...
I've recently delved into learning node/express and successfully created an api on my local machine that connects to a mongo atlas database. Everything was running smoothly until I decided to deploy it on a Digital Ocean VPC using Ubuntu 23.10 with no ...
I am facing a challenge where I need to assign unique IDs to each object within an array. Here is the structure of my schema: { _id: something, property:value, animals: [ { dogs: [ { name: 'Dog1' }, { name: ...
After searching extensively on SO for a question similar to mine, I have come to the realization that my issue should be quite straightforward. The closest thread I discovered was this link. My current focus is on learning Node.JS, and I am in the process ...
I stumbled upon this code snippet that checks if the number of occurrences of an element in an array is greater than a specified value, and if so, it will remove the number: function deleteNth(arr,x) { var cache = {}; return arr.filter(function(n) { ...
Seeking guidance on integrating Node.js and Express with mySQL. I aim to create a basic application using these technologies but unable to find helpful tutorials so far. ...