Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7959883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:38:32+00:00 2026-06-04T04:38:32+00:00

being a beginner i m trying to develop a very simple service using express

  • 0

being a beginner i m trying to develop a very simple service using express in node js the aim of my service is that a simple index page taking a value and after submit it show on next page..

The Problem:
When i run it from terminal i.e. node app.js
The server start Running On port 3000
but When i execute it on browser .e.g Fire Fox it show me the Following error
“The page isn’t redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.

The following is the code of my server App.js File

var express = require('express');
var service = require('./routes/service');
var app = module.exports = express.createServer();

// Configuration
app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser());
  app.use(express.session({ secret: 'your secret here' }));
  app.use(require('stylus').middleware({ src: __dirname + '/public' }));
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

app.configure('development', function(){
  app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function(){
  app.use(express.errorHandler());
});

// Routes
app.get('/', service.home);
app.post('/',service.home_post_handler);
app.get('/items', service.items);
app.listen(3000, function(){
  console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
});

Service.js (Route defined)

exports.home= function(req,res){
  if(typeof req.message== 'Undefined')
    res.render('home', {title:'My Service'});
  else
    res.redirect('/items');
};

exports.home_post_handler = function(req,res){
  message = req.body.message || 'Message Command is Empty';
  req.message = message;
  res.redirect('/');
}

// Just using cox in tutorial there they use it as database
/*var items = {
  WEL:{name:'Welcome Dear'}
}*/

exports.items = function(req,res){
  if(typeof req.message == 'undefined')
    res.redirect('/');
  else
    res.render('items',{title:'My Service - Message', message:req.body.message, items:items});
}; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:38:33+00:00Added an answer on June 4, 2026 at 4:38 am

    The following middlewares have a chance to keep redirecting to each other.

    exports.home= function(req,res){
      if(typeof req.message== 'Undefined')
        res.render('home', {title:'My Service'});
      else
        res.redirect('/items');
    };
    
    exports.items = function(req,res){
      if(typeof req.message == 'undefined')
        res.redirect('/');
      else
        res.render('items',{title:'My Service - Message', message:req.body.message, items:items});
    }; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Being a beginner of using Django, i am trying to add some module for
I'm trying to get simple code working, unfortunately I'm a python beginner. My script
I'm trying to save simple text data in my app using this code from
Please forgive me for being a complete beginner: I am trying to log into
Being a beginner C/C++ programmer, I am having to spend several hours, trying to
I'm a beginner programmer, so this question might be a little simple. I'm using
This is a very simple question, and I apologize for being so noobish :/
I'm trying to write some code for simple complex number manipulation. I'm using a
I'm trying to make a page that once someone logs in, they can view
I have came across the following code, and being a C beginner, I came

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.