Recently, I found the need to modify our local strategy in order to accommodate different types of users logging into our website. The current code is as follows: const localLogin = new LocalStrategy(localOptions, function(email, password, done) { // V ...
Looking to utilize the 'utils-merge' node module that is included as a dependency of express 4.12.3 within my server application. I have successfully installed express on my server. I attempted: var merge = require('express/utils-merge'); as well as var ...
Recently, I delved into using express.js with handlebars.js as my template engine. One task I wanted to tackle was creating a delete link that followed RESTful principles and used the HTTP DELETE verb instead of GET. After some trial and error, I discover ...
Recently delving into Jade for a new project and finding it to be quite impressive so far. However, I've encountered a little snag with the Extends feature. The block I created doesn't seem to display when rendering layout.jade. layout.jade: di ...
My attempt to create ad hoc and OpenSSL based certificates in Python Flask was inspired by a tutorial I found on this website. I also explored the method of creating root CA, trusting it, and generating certificates as outlined on this GitHub thread using ...
I've been grappling with this issue for quite some time now, and any assistance would be greatly appreciated. Initially, I attempted to resolve the problem by utilizing the Moralis nodeJs library. While it worked fine on my local environment, it retu ...
I recently integrated the hcaptcha widget into my login component by utilizing the following package: https://github.com/hCaptcha/vue-hcaptcha. The challenge is functioning correctly on the front end. Upon inspecting the response object in the network tab ...
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. ...
I currently have a website built using Keystone and another one that is completely static. My goal is to combine the static site into the Keystone site. When users visit "/", they should see the static site, but if they navigate to "/resources", they wil ...
Currently, I am working on a node.js application that is connected to a remote mongoDB server. Inside the database are specific custom codes that have been created and shared with selected users. The main objective is to restrict access to the rest of the ...
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 ...
Hello, I am relatively new to node.js and express. I am currently working on setting up a mongoose schema to allow users to create characters and store them in the associated collection with that user. I have two schemas in place, one for users and one for ...
Recently, I encountered an error while trying to add comments to my posts by using nested populate for mongoose. Initially, everything was working fine when I only pre-populated user data. However, as soon as I implemented nested populate, I started receiv ...
I am currently running a frontend and express JS server on AWS Lightsail using Ubuntu with Nginx as the host. The server is configured as a reverse proxy. Here is the configuration: location /api/ { proxy_pass http://localhost:4000/api/; proxy_http_vers ...
I am looking to create secure redirects exclusively within the domain example.local. Valid examples include: http://blog.example.local, http://www.example.local/dashboard; whereas invalid examples are: http://blog.example.local, http://blog.example.local.f ...
Today is my first time experimenting with firestore and express. Here is the code snippet I am using: app.post('/api/create', (req, res) => { (async () => { try { console.log(req.body); //the above consle.log shows th ...
My setup involves websockets with AWS API Gateway, an EC2 instance running Node.js and Express with WS websockets. I can send a message from wscat to the API Gateway WSS URL and it shows up in the EC2 instance. However, when I send a message from the EC2 i ...
After retrieving objects from my postgres database, I am attempting to add a new property to each object. Strangely, when I log the entire object, the new property appears as expected. However, whenever I try to access or store this new property in another ...
In my .babelrc file, I have only included the es2015 preset and I am using a Webpack 2 configuration for my project. I want to create an express app in ES6. Here is the webpack configuration: const path = require('path'); module.exports = { target: 'no ...
router.get('/',(req,res,next)=>{ console.log('initial middleware function'+req.originalUrl) }) VS router.use('/',(req,res,next)=>{ console.log('initial middleware function'+req.originalUrl) }) Could someone shed light on the behavior differences ...
Within my code, I am passing email as a scope like this: router.get(keys.facebookCallbackURL, passport.authenticate('facebook', { scope: ['public_profile', 'email'], failureRedirect: '/', session: false }), (req, res) => { //. ...
Is it possible to enhance security for an expressjs RESTful API so that only a react native app and react website have access? For example, the server runs on port 8000, the react native app is on port 3000, and the website on port 5000. It’s desired th ...
The Issue When trying to render images saved on the backend using Express, I am facing a problem where the images appear broken in the browser. Despite looking for solutions to similar issues, none have resolved the issue for me. Specifics In my server.t ...
My HTML index.html file has multiple containers, and I have included the bootstrap and font awesome folders in the <head> section like this: <link href="../bootstrap/css/bootstrap.css" rel="stylesheet"> <link href="../bootstrap/css/bootstra ...
I am currently working on a Node application powered by express and I am looking to properly handle apostrophes within the incoming request body properties. However, I am not entirely convinced that my current approach is the most efficient solution. expo ...
I want to update the articles attribute by adding the titles of different articles. The function in my user.controller.js file looks like this: module.exports.savearticle = (req, res, next) => { User.findOneAndUpdate( req._id, { $addToS ...
Currently, I am utilizing log4js logger with node express to log errors to a file. However, the log files are quite difficult to interpret and I rarely look at them. I recently integrated Sentry into my project. I want to be able to manually send errors t ...
I am receiving the following response from Express and I am looking to display the supertendentsSignature image in Angular 2. Database: SQL Server Dataytpe : Image ORM: Sequelize Datatype of SuperintendentsSignature column is Blob Framework : Express Fro ...
Embarking on my journey in web development using node.js, I encountered an issue while trying to load a particular page, which led to the following error message in my browser: Cannot GET /public/pages/terms-and-conditions.html The file structure is orga ...
Hello there! I need some assistance in resolving an error that I'm facing. Here are the details of the issue: I am using NodeJs with Web3.js to retrieve the balance of an account address in Blockchain using the 'getBalance()' function. The code runs perfec ...
My nodejs application is encountering issues with express-session when running on gcloud production, although it works perfectly in my local development environment. app.js var express = require('express'); var path = require('path') ...
The function verifies whether the route is accessible or not function checkSessionCookieValidity(req, res, next) { if (!isValid(req.session)) { return res.status(401).json({ isLoggedIn: false }); } return next ...
From a conceptual perspective, the request flows through various middleware until it reaches the final middleware, where the response begins. Is the request terminated at the entry point of the app or in the final middleware? When is the response object c ...
Seeking suggestions for passing a parameter into a MEAN application without compromising the URL aesthetics. I must find a solution that does not involve client-side storage. The following Express route effectively integrates the parameter into the Angular ...
Hi there, I'm currently exploring MongoDB and Mongoose. My goal is to prevent users of my API from storing duplicate contact names in the Mongo database, but unfortunately it's not working as expected. This is how I have set up the validation: both name a ...
I made the switch to using https for my nodejs server by following these steps: const https = require('https'); const privateKey = fs.readFileSync('sslcert/server.key', 'utf8'); const certificate = fs.readFileSync('sslcert/server.crt', 'utf8'); var crede ...
I need to enhance the security of my application by restricting users from accessing profiles of other users. route.js router.get('/currentUser/:username', userAuth, (req, res) => { User.findOne({ username: req.params.username }).then(user =&g ...
res.sendFile is the preferred method for serving a static file in express. However, it appears that res.sendFile reads the file from disk with each request, as shown below: router.get('/', (req, res) => { res.sendFile('./guest.js&apo ...
I am currently working on implementing a contact form using express 4.9 and nodemailer. However, I am facing an issue where I can't seem to capture the req.body data. Sending emails with hardcoded values works perfectly fine. I tried adding bodyParser ...
I am facing an issue when trying to upload a file to a remote spring server through an API. Despite converting the data into form data, I keep receiving an unsupported media type error (415). Below is the HTTP post request using express: var FormData = r ...
My mongodb collection is named 'people' and the schema looks like this: people: { name: String, friends: [{firstName: String, lastName: String}] } I have an express application that connects to this database and successfully cre ...
I've been utilizing the http-proxy-middleware to handle my API calls. Is there a way to proxy multiple target hosts? I've searched for solutions in the issues but still haven't found a clear answer. https://github.com/chimurai/http-proxy-m ...
Hey everyone, I'm new to coding and currently working on creating a basic markdown blog. However, I'm facing an issue where req.body doesn't contain my markdown field and req.file is undefined when trying to upload an article. I'm unsur ...
Recently, I've been delving into the world of Express and experimenting with a program that allows users to create events and invite others. While I know about using join tables to retrieve data, I'm curious if there's a way to organize the data in nested ...
Currently, I am working on developing a SSR Nuxt.js application that integrates with a REST API server. In order to achieve this, I have included my endpoint /api into the Nuxt server.js code as shown below: const express = require('express') c ...
Within the context of my current test project using Node.js and Express, I am utilizing JWT for authentication. When handling a POST request, I ensure that the user sending the request is identified by including the JWT with it. Once this request reaches t ...
My website has a page located at /request that features a form. The form's method is POST and the action leads to /request. In the POST handler in request.js, the intention is to take action with the form data, like storing it in a database, and then ...
I've been diving into iisnode and expressjs to create a REST-like API using node. In my server.js file, I set up something like this: app.put("/test", function(req, res){ ... }); However, when I send a PUT request, I keep getting a 405 ...
I am looking for a way to redirect users who are not logged in from an individual post's page to the login screen, and then back to the post after they have successfully logged in. Here is my login route: router.get('/login', function(req, res, next){ ...
My journey with PostgreSQL begins as I delve into creating a REST API using Sequelize for PostgreSQL, Express.js, and Node.js. One of the challenges I encountered was setting up a user system where each user can have multiple parcels associated with them. ...
I've encountered an issue while attempting to submit a basic form within a React component: class UploadPartList extends Component { constructor(props) { super(props); this.state = { data: [] }; this.handleSubmit = this.handleSubmit.bi ...
I'm facing an issue with the post method in my back-end code. Here's a simplified version of it: router.post('/users', async function(request, response) { try { const userToRegister = request.body; const user = await CreateUserService.execute(use ...
I am looking to execute a separate function, like a Service function, before Sails renders the page into HTML. Please refer to the controller code below... var MYController = { index: function(req, res, next) { req.flash("error", "Testing hello ...
Currently, I am following a tutorial video and trying to implement the code provided. This is the code snippet at the beginning of my routes/index.js file: var todo = require('../todo'); //line 1 //line 2 //new session //line 3 exports.newSession = functi ...
I am facing a challenge where I need to host multiple node applications on a single server. To achieve this, I have set up the applications to run on different ports and can access them by specifying the IP address along with the respective port numbers. ...
Currently, I am in the process of developing a menu for my ReactApp that mirrors a folder structure. Each folder is categorized based on the documents it contains, with some folders having sub-folders and files nested within them. The desired output shoul ...
I have a Node.js API called /create/appointment that performs two operations: STEP 1: Checking for an active appointment in the database. STEP 2: Creating an appointment if it does not exist. There are three collections: doctors patients appointments ...
Recently, I developed a real-time chat application using socket.io, Node.JS, and express. It was functional on my local server but now I want to connect it to an existing Heroku service instead. How can I achieve this? Once I tried the following code, va ...
I've been working on a simple nodejs application that allows users to log in with Facebook using express and everyauth. I followed the instructions provided in the README tutorial here and set up my app.js file as shown below: var everyauth = require('eve ...
I am facing an issue with my function that reads data from the database. I am trying to change the value of the "hasVoted" field in my Voters model from false to true, but it is not reflecting in the database. Even after setting data.hasVoted = true and c ...
Having spent a significant amount of time researching how to set up MongoDb in an Express/NodeJs application, I believed I had a good understanding of how to implement it efficiently. I decided to initialize my mongodbConnection in the WWW file provided by ...
Search for results in the index and return them. Method: async fetchIndex(req,res){ const userResults = await Usuario.find(); res.json(userResults); }, Route: routes.get('/api/usuarios', Usuario.fetchIndex); Having trouble getting re ...
I'm currently in the process of setting up Express routes linked to multiple controllers. These routes are expected to receive functions, and here is what I have been attempting: authRouter.get('/login/redirect/:provider', controllers.handleOAuth2Redirect ...
Just starting out with Node.js and utilizing express along with hogan or moustache templating for my views. I've successfully used the following code in my routing files, index.js as shown below: /* Test Shell Execute. */ router.get('/shell', function(re ...
I am relatively new to working with Node.js and Express.js. My goal is to set up a websocket server that can send CSV data at irregular intervals stored within the file itself, line by line. The structure of the CSV looks something like this: [timeout [ms] ...
I am currently exploring NODEJS in conjunction with react. In a typical scenario, the request to edit posts would look like this: router.put("/:id", function(req, res) { Campground.findByIdAndUpdate(req.params.id, req.body.campground, function( e ...
I recently generated a file named credentials.txt located at ~/.aws/credentials.txt. The contents of this file include: [bogdan-ses-user] aws_access_key_id = *** aws_secret_access_key = *** Establishing Node JS Server Locally const express = require(&apos ...
The image is successfully displaying in the Profile.js screen and other areas. However, when attempting to pass the image via useContext() to display in Navigation.js, it shows as src(unknown). What could be causing this issue? https://i.stack.imgur.com/w ...
After gaining some knowledge about NodeJS, I am now eager to develop a large enterprise application using it. However, I am uncertain about how to properly structure the project. Having experience with languages like PHP and Java, my initial thought is to ...
I'm currently developing a basic local image server that supplies images to a web application along with some JSON data. The web app includes pagination functionality which triggers a get request "/images?page=X&limit=200" to an express.js server, rec ...
I'm stuck trying to connect my database with my React app. I created the database using SQL in SQL Server Management Studio. I attempted to use express for the connection, but it seems like there are pieces missing in my code. Can someone guide me on what ...
Developing a voting application that involves creating two models: users and polls. The database will have two collections - one for users and one for polls. User.js 'use strict'; var mongoose = require('mongoose'); var Schema = mongoose.Schema; var Use ...
I am currently using MEAN.IO to create a web application. Right now, I am working on implementing an image uploader feature. I have decided to use angular-file-upload for this purpose, and it seems to be functioning well. However, I am facing an issue on ...
Greetings, I want to start by apologizing if the title of my question caused any confusion for those reading it. I struggled to find the right wording. The issue at hand involves a problem with sending a get request from my axios instance to my express ins ...
I am puzzled by the fact that the req.body appears to be empty... app.js utilizes the body-parser middleware() var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var index = require('./routes/index'); var users = requir ...