I am trying to incorporate the sample socket.io chat application from the socket.io website into a nw.js application to create a standalone socket client and server. However, I encountered an error when starting nw.js: [5591:0222/143044:ERROR:nw_shell.cc( ...
Currently, I am attempting to establish communication between a Python client and a Node.js server using Socket.io 0.7. My goal is to send a custom event from the client to the server. To achieve this, I have been referencing the Socket.io documentation o ...
Attempting to modify an object in a list using this approach failed const { bins: data } = await client.get(key); // { array: [{ variable: 1 }, { variable: 2 }] } const { array } = await client.operate(key, [Aerospike.maps.put('array', 3).withCon ...
Running an express server with express-stormpath for authentication and storing custom user data has been smooth sailing. But I'm facing a challenge when it comes to posting data to the server and saving it to stormpath. Here's how my current po ...
Below is the code snippet I am currently working with: // Initializing express, body-parser, mongodb, http, and cors var app = express(); app.use(cors()); app.use(express.urlencoded()); // Parse incoming JSON data from API clients app.use(express.json()); ...
I need to validate a field within an object based on specific values in another field. Let's say I have two fields, field1 and field2. The possible values for field1 are A, B, C, D, E, F, H, I. If field1 has the value of A, B, or C, then field2 should be n ...
My objective is to transfer an image captured from a webcam to a Lambda function, which will then upload it to AWS S3. The Lambda function appears to work during testing, but I'm struggling to determine the exact data that needs to be passed from the ...
I have implemented a basic login route in express: //login router.post('/login',async (req,res) => { try{ const user = await User.findOne({username: req.body.username}); console.log(user); if (!user) { ...
I have successfully developed my Angular web application with the following features: var app = angular.module('flapperNews', ['ui.router']); app.factory('posts', ['$http',function($http) { var posts = [ ...
Is there a way to achieve this using Joi? For instance: Joi.string() .required() .min(8) .max(16) .pattern(/(?=(?:.*[a-z]){2,16}).+/) .pattern(/(?=(?:.*[A-Z]){2,16}).+/) .pattern(/(?=(?:.*[0-9]){2,16}).+/) .pa ...
I am struggling with the timezone settings on my server. My backend is using Node.js and Express routes for services. I adjusted the server time to the correct one by running: dpkg-reconfigure tzdata I verified that the server time appears accurate. ...
When starting a new NextJS project using the CLI, there's an option to use --use-npm when running the command npx create-next-app. If you run the command without any arguments (in interactive mode), this choice isn't provided. In the documentati ...
Currently, I am delving into the world of handlebars for templating on my website. As a user of node.js, I opted to utilize the popular express-handlebars module due to its extensive support within the community. Setting up the basic configuration was str ...
It seems like the Datadog AWS Lambda instrumentation is giving me trouble. I keep encountering this error every few invocations: "errorType": "Runtime.HandlerNotFound", "errorMessage": "/opt/nodejs/node_modules/da ...
Is it possible to retrieve the entire document instead of just the new item after calling save()? var newItem = Items({ ID: req.body.ID, Name: req.body.Name }); newItem.save(function (err, items) { if (err) throw err; res.send(items ...
I've been working on uploading images to S3 using AWS Lambda. I found some helpful code in a URL and made some modifications to the variables fileFullPath and Bucket: Upload Image into S3 bucket using Api Gateway, Lambda funnction const AWS = requir ...
While working with mongodb and nodejs to search for data within an embedded document, I encountered a strange issue. The query functions as expected in the database but not when implemented in the actual nodejs code. Below is the structure of my data obje ...
Upon creating a new Angular project, I encounter warning messages from NPM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="68e01b0d1e0d061c7518d7">[email protecte ...
Everything is running smoothly with the code, but after a few seconds, an unexpected 'Polling error' message pops up in the console. I tried looking for solutions online, but unfortunately, I couldn't find anything helpful. If anyone has any insights or ...
Currently, I am collaborating on a project that involves song matching, which requires integration with rapidApi's shazam endpoints. The challenge lies in the fact that the song matching endpoint necessitates the audio snippet to be a base64 string of the ...
My issue involves setting up a form submission where the URL turns into undefined. Here's the current view: http://localhost:3000/dashboard/tours/categories router.get('/tours/categories', function (req, res) { res.render('agents/t ...
Currently, I am working on honing my skills in mongodb and nodejs, but have encountered a hurdle along the way. Within my mongoDB database, there is a table named Schedule containing fields such as id, start, and end. My objective is to augment the start t ...
const express = require('express'); const app = express(); app.use('/', anyroute); // in anyroute file router.route('/:id').get(controlFunction) controlFunction(req, res, res)=> { // Here we can get the "id" from the variable with req.param ...
Take a look at this code snippet: let num01 = Buffer.from(Number(1).toString(16), "hex"); console.log(num01); let num02 = Buffer.from("02", "hex"); console.log(num02); let num16 = Buffer.from(Number(16).toString(16), "h ...
Looking for assistance in listing the data from a CSV file stored in S3 using Node.js code. Below is the provided code, but I am seeking help to achieve the expected output as shown: CODE: const AWS = require('aws-sdk'); const fs = require('fs'); const ...
I've been trying to deploy my Angular application on Azure. While I can successfully publish it using Azure, I keep encountering an error message when trying to access the published site: AggregateException: One or more errors occurred. (One or more ...
Currently, I am facing an issue with uploading photos via Cloudinary and inserting the photo URL into my database table to save them on the page. Even though my route is configured correctly and not crashing the server, it seems that the data is not bein ...
When making an API call from my React app on port 3000 to a Node API running on port 8080, I encountered an error message: XMLHttpRequest cannot load http://localhost:8080/register. Response to preflight request doesn't pass access control check: No ...
While working on creating a backend using ExpressJs, I encountered an error when running the backend. app.use(cors()) ^ ReferenceError: cors is not defined at Object.<anonymous> (C:UsershpDesktopEntrikanbaindex.js:5:5) at Module._c ...
<!DOCTYPE html> <html> <body> <form action = "/submit" method = "post"> Select a file: <input type="file" name="file"> <input type="submit"> </form> </bod ...
Currently in the process of constructing a node express app, I have encountered a dilemma when shipping package.json to production. The issue lies in the fact that it includes code for unit testing as well. Is it advisable to create two separate package. ...
The code snippet I am working with looks like this - sendServer.get('/download',function(request,response){ var status="SELECT * from poetserver.download where status='0'"; console.log(status) connection.query(status,function(error,ro ...
I'm currently developing a simple API using Mongoose, Express, and Node.js. However, I've encountered an issue when trying to click on the "Read More" link, which utilizes Express routing parameters. Whenever I do so, I receive an error message stating "Er ...
I am attempting to access a file: fs.readFileSync('~/node_modules/.bin/lasttest.txt', "UTF-8"); However, I receive an error stating that the file or directory does not exist. Interestingly, when I execute the command: sudo nano ~/node_modules/.bin/send. ...
I've been working on my first angular2 program and noticed some deviations from the expected output. typings.json: { "ambientDependencies": { "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5d ...
Whenever I establish a connection to the server socket from the client side, specifically using React, I notice that the socket client sends repeated requests every few seconds. These requests are primarily of the "get" type and often end up in a pending s ...
Before storing data in the database, my server performs validation checks. If it is unable to save the data into the database, an error message is sent. In my client-side application, how can I retrieve and display this error message? Below is the HTTP r ...
I've been diving into several MEAN tutorials, and I've hit a snag that none of them seem to address. I keep encountering this error message: Uncaught TypeError: mongoose.model is not a function Even after removing node_modules and reinstalling everything ...
Despite my best efforts to troubleshoot by removing, re-installing, and re-hashing npm, I continue to encounter this persistent error whenever attempting to run any npm related command: prompt$ npm ------ npm ERR! EEXIST, mkdir '/usr/local/bin/npm ...
I'm facing a dilemma with my telegram bot - I need to send a message, but also stop the code from continuing execution. consloe.log("You shouldn't see this text"); Oddly enough, the message doesn't get sent when I include process.exit(). It seems like th ...
Searching for a way to obtain the base URL for an HTML page, so that relative URL requests from the browser utilize that base. If you are looking for answers, check out this link: Defining root of HTML in a folder within the site root folder When serving ...
I'm experimenting with streaming to upload and download files. Here is a simple file download route that unzips my compressed file and sends it via stream: app.get('/file', (req, res) => { fs.createReadStream('./upload/compres ...
When working with NodeJS and trying to connect to a Cosmos DB using the Documentdb library, I encountered an issue as described in the getting starter of the azure documentation's TODO List Example. You can find the tutorial here. The connection code I us ...
Within my express route, I have the following code snippet: let response = await fetch("http://someurl"); response = await response.blob(); console.log(response) const imgURL = URL.createObjectURL(response); However, I am encountering an error a ...
Can NodeJS be built together with specific JavaScript modules? I am aware that for native modules, node-gyp can assist with this, but I am unsure about how to accomplish this with JavaScript modules. My goal is to use a custom application without needing t ...
Recently, I encountered an error message that prevents me from using 'import' in my front end code when trying to execute 'node index'. This issue never occurred before, and it only arose when I returned to this project. In my backend ...
I have a setup using npm and webpack, and a part of my application requires Web Workers. The traditional way to create web workers is by using the syntax: var worker = new Worker('path/to/external/js/file.js'); In my npm environment, this metho ...
There is a code in place that triggers when an email is sent to the user, containing a link that leads them to a specific endpoint upon opening. I am experiencing issues with redirection at the end of the function. The redirect does not seem to be working ...
Is there a way to get all the data in one go after the for loop is completed and store it in the database? The code currently receives user object id values through req.body. If the server receives 3 id values, it should respond with 3 sets of data to th ...
Hey there! I'm currently working on a project that involves a multi select input field that is structured like this: input.form-control(type='text', name='names[]') I am trying to retrieve the values from this field, and I attempted to do so using the fo ...
Is there a way to pass parameters to the aggregation process? I am receiving parameters and attempting to use the $match operator, but the query is returning an empty array: app.get('/api/:name', function(req, res){ var name = req.params ...
I'm currently working on an express nodejs app where I am attempting to implement "dynamic routes" within another route. Here is what I have: .... app.use('/test/:id', function(req,res,next) { app.use('/foo', sta ...
I have organized the src directory of my project in the following structure: . ├── config.ts ├── protos │ ├── index.proto │ ├── index.ts │ ├── share │ │ ├── topic.proto │ │ ├── topic_pb. ...
Just diving into the world of Node.js. Let me wrap my head around this line: module.exports = process.env.EXPRESS_COV ? require("./lib-cov/express") : require("./lib/express"); I understand that EXPRESS_COV is a Boolean, but can someone explain to me the ...
Recently, I encountered an issue while using NodeJS with React. I was unable to find any npm module or code snippet that could help me implement pagination for a list of job results. I have a variable named "jobs" which stores a list of job advertisements ...
I recently set up my Node.js application directory and noticed a presence of several core.* files. I am curious about their purpose - can these files be safely removed? The setup involves installing Node.js alongside Apache using mod_proxy to host one of ...
Exploring the capabilities of top-level await introduced with TypeScript 3.8 in a NodeJS setting. Here's an example of TypeScript code utilizing this feature: import { getDoctorsPage } from "./utils/axios.provider"; const page = await getDoctors ...
New to the world of node, and feeling a bit lost when it comes to all this "install" stuff. Could someone clarify for me, what sets apart install from install -g? If something is installed with install -g, can it be accessed from anywhere, or is it restr ...
Purpose In the process of creating a series of 'extractor' functions to identify components on a page using jsdom and nodejs, I aim to organize these identified 'component' objects based on their original placement within the page. Challenge The final s ...
I've encountered an interesting issue with my use of NodeJS and Socket.io. The server receives data through ZeroMQ, which is working perfectly fine. However, when there are a large number of connected clients (over 100), it appears that there is a de ...
My journey into the world of JavaScript began with a project to create a high-performing MSSQL REST API using Express. After studying some basic examples, I was able to develop a functional code: const utils = require('../utils'); const config = require('. ...
I've been facing an issue with using Axios to send a POST request to my Node.js server. Any suggestions on how I can troubleshoot this problem? Here is a snippet of the code in question: server.js: app.post('/registration', (req, res) => { console. ...
I currently have a server running on localhost:3000, with my app.js set up to utilize the angular router. When attempting to access localhost:3000 in my browser (for example: app.use('/', express.static(path.join(__dirname, '/dist/Client')));), everything ...
Recently, I attempted to launch a Maka-CLI web application on my Android device using the command "maka run android-device". Unfortunately, I encountered an error that persists and displays the following message: => Errors executing Cordova commands: Whi ...
Currently utilizing Express and ReactJS Express Code: const Express = require('express'); const PORT = 5000; const cors = require('cors'); const server = Express(); server.use(cors()); // CORS added here server.get('/users', (req, res) => { re ...
When I utilize req.headers.host in my Express.js and Nodejs 6 application on an SSL enabled server, I encounter an error stating that the header is undefined. This is my code: if(req.headers.host.indexOf('domain.com')>-1){ ...... } The error messag ...
Does anyone have suggestions on how to set variables in my environment files? Website_Base_URL=https://${websiteId}.dev.net/api In the code, I have: websiteId = 55; and I would like to use config.get('Website_Base_URL'); to retrieve the compl ...
Recently diving into the world of socket-io and react, utilizing express for the backend. The socket.io-client version being used is 3.0.3, while the backend's socket-io package matches at 3.0.3 as well. Interestingly enough, the server handles connections ...
Curious minds want to know the purpose of express.favicon(). After searching, I still haven't found a clear explanation. Can anyone shed some light on this? app.use(express.favicon()); I came across information that this command ignores GET requests for ...
Currently, I am attempting to create a loop within a loop in my NodeJS code, but I seem to be getting lost along the way. The results are not as expected - sometimes callbacks are triggered twice and so on. My approach involves using the async module. I wo ...
Update: 27th December 2016 The heading has been modified because any DOM element can be the target, whether it is a <p> element or not. Additional information has been provided about the tools being used and the desired outcome. Are there nativ ...
After creating REST services using Node JS, Express, and Mongo DB, I encountered a problem with my POST request to add users into the database. When testing the service locally using POSTMAN, the user gets added successfully, but the node app crashes (serv ...
I'm currently working on a project that involves using nodejs to read a file line by line and then converting the result into a JSON string. However, I've encountered an issue where the console.log returns undefined instead of the expected list. Although I ...
My journey to deploy my app on Heroku has hit a roadblock. The import statements, like import cors from 'cors', are causing the app to fail in production with the "Cannot Load ES6 Modules in Common JS" error. Interestingly, everything runs smoothly locally ...
Currently, I am in the process of developing a script that utilizes node.js, fbgraph API, and the express framework. My task involves sending the user's access_token from an index.html page to the nodejs server via a POST request. I have successfully ...