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

426
Views
Express.js unexpected 'GET' to '/json/version'

I'm new to Express, but I keep getting a 404 error because something is making a GET request to '/json/version'. It goes through the first app.use('/') and adds the session data, then it ignores the two routers, and then triggers the 404 error handling. Does anyone know where it could be coming from? It's holding up my project and I'm quite frustrated.

I found someone with the same issue here, but nothing has been very helpful (as far as I can tell). Most of this app is generated from express-generator, with only the session being added by me, but I can't find any documentation from express-session that says this is expected behavior. Below is my code.

// Package requirements
let createError = require('http-errors'),
    express = require('express'),
    session = require('express-session'),
    path = require('path'),
    cookieParser = require('cookie-parser'),
    logger = require('morgan');

// Local requirements
let indexRouter = require('./routes/index'),
    usersRouter = require('./routes/users');

// App definition
let app = express();

// View engine setup (EJS)
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

// Session data
app.use(session({
    secret: 'Super Secret',
}));

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', (req, res, next) => {
    req.session.id = 1;
    next();
});
app.use('/', indexRouter);
app.use('/', usersRouter);

// Catch 404 and forward to error handler
app.use(function(req, res, next) {
  next(createError(404));
});

// Error handler
app.use(function(err, req, res) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

// Specifies Node.js port
app.listen(3000, function() {
  console.log('Listening on port 3000')
});

module.exports = app;

Thanks in advance!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Was addressed in this issue.

Click "Configure" in chrome://inspect and remove port 3000

over 4 years ago · Santiago Trujillo 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!