Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
NodeJS: Cookie is undefined

I'm trying to make a simple GET request to my localhost:8080. When I make the GET request with Postman, I set a simple cookie. Now, in the main file, I've:

var express = require('express');
var app = express();

const cookieParser = require('cookie-parser');
app.use(cookieParser()); 
const app_router = require('./routes/router');

app.use("/api", app_router);
app.use(express.static('public'));


app.listen(8080, function () {
    console.log('Outdoor Localization GNSS middleware.');
});

In routes/router.js I have:

var express = require('express')
const router = express.Router();
const axios = require('axios');
const url = 'http://10.10.0.145:80/api'

router.use(express.json());


router.get('/*', function (request, response) { 
   console.log(request.Cookie)

    axios
    .get(request_url)
    .then(res => {
    console.log(request.Cookie)
    })
    .catch(error => {
      console.error(error)
    })
});

The problem is that request.Cookie always return undefined...why is this happening?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you should be accessing the property request.cookies instead of request.Cookie

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!