Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion CGI example needed
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Arunoda Susiripala  
View profile   Translate to Translated (View Original)
 More options Jul 8 2012, 2:21 pm
From: Arunoda Susiripala <arunoda.susirip...@gmail.com>
Date: Sun, 8 Jul 2012 23:51:48 +0530
Local: Sun, Jul 8 2012 2:21 pm
Subject: Re: [nodejs] CGI example needed

You need this - http://expressjs.com

Read the guide.

On Sun, Jul 8, 2012 at 11:38 PM, Dan Milon <danmi...@gmail.com> wrote:
> You wouldn't use node as a cgi script (at least for the web part).
> Technically you can, but you would lose all the benefits
> (async/nonblocking io) since you let apache or any http server for the
> matter enforce the concurrency model. Afaik, the cgi server will pull up
> node processes for each request, which is overkill (startup times) or pool
> them but things will get complex.

> As it concerns network/http related scripts, its a big no no, unless you
> cant replace the http server in your stack, and really need to use node
> (which is a silly case)
> If you have to use cgi, i suggest you keep using php/python.

> Why dont you use node as the server also? (not only processing requests)

> On 07/08/2012 08:01 PM, Tim Johnson wrote:

>> I've been a CGI programmer for 16 years. I have used python for the
>> last 9. I currently use javascript for client-side programming. I am
>> interested in using node.js for server-side programming.

>> I've done a little googling on CGI interfaces for node, but I am
>> finding *too* much information.

>> I am including an untested pseudo-code based on python. With that as
>> a reference, I would welcome some javascript code which would work
>> similarly:
>> code follows
>> ##############################**##############################**######
>> #!/usr/bin/python
>> import cgilib   ## my cgi module
>> import mvcLoader as load  ## handles importing controller modules
>> ## script loader.py (the executable 'parent' module)
>> ## is the post action for a form which
>> ## accepts an email address and a password as input fields named
>> ## "email" and "password".
>> ## loader.py has a virtual document path that has as path part 0
>> ## a key for the controller that will be `import'ed by the parent module.
>> ## the post action might look like this:
>> ## "http://localhost/cgi-bin/**loader.py/auth<http://localhost/cgi-bin/loader.py/auth>
>> "
>> if __name__=="__main__":
>>      ## instantiate the cgi object and in doing so,
>>      ## process the CGI environment
>>      cgi = cgilib.Cgi()
>>      ## print the mime-type header
>>      cgi.header('text')
>>      ## Retrieve the values POSTed for 'email' and 'password'
>>      user = cgi["email"]
>>      pwd = cgi["password"]
>>      ## Retrieve the key for the controller module which will then be
>> imported
>>      ## by the load.controller() method
>>      controller_key = cgi[0]
>>      controller = load.controller(cgi[0])
>>      ## And the rest of the work happens below
>>      ## in the imported controller module
>>      controller.process(user,pwd)
>> ##############################**##############################**######
>> The intent and mechanics of my mvcLoad module should not be relevant
>> to this dicussion. What is relevant is allegories to
>> cgi[keyname]
>> and
>> cgi[virtual_document_path_**index]

>> I hope that the example makes my question clear. I don't expect
>> anyone to "roll their own" tutorial, but URLs to discussions
>> on similar node interfaces would be most helpful.

>> TIA

> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-**
> Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscribe@**googlegroups.com<nodejs%2Bunsubscribe@googlegroups.com >
> For more options, visit this group at
> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>

--
Arunoda Susiripala

@arunoda <http://twitter.com/arunoda>
<http://gplus.to/arunoda>https://github.com/arunoda
http://www.linkedin.com/in/arunoda


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.