Category "express"

Express js,mongodb: “ReferenceError: db is not defined” when calling a function

The code is set up this way: var express = require('express'); var router = express.Router(); var mongo = require('mongodb').MongoClient; function getData(){

CORS in node blocks POSTMAN to get data?

I'm using POSTMAN dev tool to test this API : http://localhost:3000/users and I have this express.js script : const express = require("express"); const cors

How to handle React Router with Node Express routing

I am trying to manage a react app with react router and node js server my router in react: <BrowserRouter> <Switch> <PrivateRoute tok

MongoDB sets my database to 'test' automatically. How to change it?

mongoose.connect(process.env.DATABASE_URL, {useNewUrlParser: true}); const MyModel = mongoose.model(mymodel, new Schema({ name: String })); This creates a dat

How to tell if a user is logged in with http only cookies and JWT in react (client-side)

So I'm trying to follow the security best practices and I'm sending my JWT token over my React app in a only-secure http-only cookie. This works fine for requ

How to get access to data in Github Repo with Nodejs Express

I'm currently trying to get COVID-19 from the Covid Data Repository by Johns Hopkins. https://github.com/CSSEGISandData/COVID-19 The repo get updated with new d

How to do update in AWS Dynamo DB using NodeJS

I have written this function to do update in dynamo table const updateTask = async (req, res) => { try { const { existingTaskText,updatedTaskText } = r

How to return error message objects to the client in Express?

I have this block of code: router.post('/users/login', async (req, res) => { try { const { email, password } = req.body const user = await User.fi

React Native / Expo : Fetch throws “Network request failed”

I saw several posts on the subject but without result. I have on the one hand a form which collects information (name, first name etc) then saves it in database

Failed to lookup view "index.ejs" in views directory

I have the following code in my express app (app.js file): const express = require("express"); const app = express(); app.set('view engine', 'ejs'); app.get(

Calling Express Route internally from inside NodeJS

I have an ExpressJS routing for my API and I want to call it from within NodeJS var api = require('./routes/api') app.use('/api', api); and inside my ./route

Grouping routes in Express

We can group our routes like this in Laravel: Route::group("admin", ["middleware" => ["isAdmin"]], function () { Route::get("/", "AdminController@inde

several react apps with express server

The idea is to make a lot of separate react apps on the one express server, so each of them should appear using the url something like mysite.com/app1, mysite.c

Mongodb Node.js Express how should the learning ranking be and what do they do

1 - how should the learning ranking be (Mongo db,Node.js,Express) 2 - is it only available for the web or is it also available for mobile? 3 - What do they do

node.js express-unless exclude a path from middleware.auth

I am looking to use express-unless to exclude a /health path from using middleware.auth. I am having syntax issues, and I am unable to test this locally. If I

Angular-router not works at vercel

I'm working on the serverless web MEAN and I'm trying to publish on vercel. When I'm trying to access some route through the navigation menu, the router is work

Server responds with status 405

I'm running into a small issue with my "server". So while I'm trying to learn backend to frontend communication, I was messing around and trying to create an "a

how to configure webpack HMR with express

package.json scripts: "scripts": { "build": "webpack --config config/webpack.prod.config.js", "dev": "webpack --config config/webpack.dev.config.js &a

ExpressJS - Handle multiple pages/pagination

I am trying to handle multiple pages for a search with expressjs but it seems that doesn't work at all. I have the root and the query params /properties/search

How can i upload audio file to Cloudinary with Node.js?

i deeply need help with this audio file upload to cloudinary issue I have had for several days now. I tried many times to make it work, but i am still strugglin