On 09/14/2013 12:14 AM, Reza Razavipour wrote:
> Is it possible to service a web site with node.js only or do I have to
> have a web server of sort such as express.js?
> 
> Here is what I am trying to do. I have a web application, HTML and
> javascript only on the client side. It is all in one URL... like gmail
> like...
> 
> I have my index.html page, my login page.
> I have an  index.js that is my web server running on 8080. It reads the
> index.html page and sends it to the browser. Great so far.
> 
> Now on the form, the user puts in username and password and presses
> login button, the javascript needs to call a node script, let's call it
> login.js. It will return a JSON saying success or failure.
> 
> So do I just create the login.js in the same directory as the index.js
> and I am done?
>  or do I need more framework/plumbing for the javascript to call other
> node scripts? 
> I do not have any routing since it is all one page. Correct?
> 
> Reza

Hi Reza, I think you need to do more homework on this.

You need some kind of webserver, which is what you say already have in
8080. If you are using the http module then that's what's gonna take the
hits and the routing. That index.js is the one firing up a webserver and
doing all the responses.

Websites do not work as you explained here. You need a route to make the
POST call to receive data, and GET call to send the index.html.

Kind regards.
-- 
Jose Luis Rivas
http://joseluisrivas.net/

-- 
-- 
Job Board: http://jobs.nodejs.org/
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to