javascript - Where does node.js sit in the client <--> web server flow? -


with respect how node.js fits in clients , web servers, description below correct?

  • (a) clients
  • (b) node.js running on web server
  • (c) "services" hosting business logic, database access routines, e.g. "getcustomer()". simplicity assume service (c) exposes rest interface.

so in flow, client (a) request resource node.js (b) in turn dispatch request (with it's async , evented i/o goodness) service (c) might go , customer information , returns node.js (b) via callback , in turn node.js returns response client.

1.is correct?

two related questions:

2.how node.js know service dispatch request to? have create api "stubs" in node.js mirror service apis, since client isn't talking directly services?

3.how session state handled in architecture?

first of "diagram" of usual flow:

     client                                        |                                            v                                          request                                       |                                          v                                                           (load balancer e.g. nginx)                        |                                          v                                      node.js instance                            |     |      |                               v     v      v                             db    apis   files                          

concerning last 2 questions:

  1. how want know that? node.js generic framework you'll have write code handle this.

  2. again, node.js generic. if have 1 instance could in-memory. otherwise you'd use redis or like.

you can write game servers in node.js, can crunch numbers, or write web server.

but don't have to, way or search framework way like.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -