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 3489008
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:20:27+00:00 2026-05-18T11:20:27+00:00

I am just starting node.js and I’m wondering why my small form is stopping

  • 0

I am just starting node.js and I’m wondering why my small form is stopping when I have submitted the form. This is the code I have:

var sys = require('sys'),
    http = require('http');

    http.createServer(function (req, res) {
            switch (req.url) {
                case '/':
                    res.writeHead(200, {'Content-type': 'text/html'});
                    res.end(
                        '<form action="/myaction" method="post" enctype="multipart/form-data">'+
                        '<input type="text" name="field1">' +
                        '<input type="text" name="field2">' +
                        '<input type="submit" value="Submit">' +
                        '</form>'
                    );
                    break;
                case '/myaction':
                    res.writeHead(200, {'Content-type': 'text/html'});
                    sys.puts('Hello');
                    /*
                    if (req.method == 'POST') {
                        req.on('data', function(chunk){
                            res.writeHead(200, chunk.toString());
                        });
                    }
                    */
                    break;
            }
    }).listen(8080);

sys.puts('Server running at http://127.0.0.1:8080/');

As soon as I press submit, the form connects to /myaction but never shows it. I know it connects as I see the ‘Hello’ text in the terminal. However, I see this on the browser:

This webpage is not available.

The webpage at
http://127.0.0.1:8080/myaction might
be temporarily down or it may have
moved permanently to a new web
address.

Can anyone give light to what the problem is?

  • 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-05-18T11:20:27+00:00Added an answer on May 18, 2026 at 11:20 am

    You aren’t ending your response correctly on the ‘/myaction’ -case. Use res.end() there also.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting out in Unix and need t workout this:- I have a csv
I am just starting with node.js. I have done a little ajax stuff but
This is my VERY FIRST node app. I'm literally just starting to piece through
I have an app.js node application. As this file is starting to grow, I
Just starting out with subversion, have set up repos for 3 current projects and
Just starting out, this should be a simple one but I haven't been able
Im just starting with localization today and need some information. I have a project
Just starting to figure Python out. I've read this question and its responses: Is
Just starting my way with Roboguice for android. Tried implementing this simple context injection
I have been all over this one, and I am just plumb stuck. I

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.