Lets say this again: With the setup above, you have the skeletton of your
own webserver that behaves exactly like you want it to. With that setup, it
acts like a static file server and can serve anything that is in your
assets folder ("/static"). You start your node server instead of wamp. It
acts roughly the same, except that it really does serve all files in that
folder as-is, no php preprocessing or the like.
Also,* there is no Jade or Stylus involved*. At all.
If you have a webpage that runs on wamp, and does not rely on backend logic
(no php files),* you can copy&paste it into your static file folder* and it
works right out of the box. Your webserver acts like a plain static file
server. The setup mentioned above is what you asked for in #6.
Note that .htaccess shenanigans are not supported, but you can do this more
elegantly in node anyways. To expose your api as you did using php, you
will need to get your hands dirty with node in the form of your own route
logic. express does make custom routing a bit easier on you, maybe thats a
better fit after all when you're starting out. You can still use it without
much of the extra features.
Truth be told, judging from the questions you ask and thus the views I
expect you have, you might want to take a step backwards and try and grasp
what node.js really is, what it can do and what it is good at. Almost
anything is possible, but if you keep seeing node the same way as your wamp
installation, this will stop you from understanding node. Sure, with a few
lines of code node can act like a static file server, but thats really not
all there is.
@Gregor: express does indeed evolve in the right direction; My initial
distaste when I first used it was based on its api inconsistencies and
conventions at a point when documentation was scarce and configuration
possibilities were very limited. This probably has improved by now and my
views in this regard are outdated. Still, don't let express be the next
rails.
All the best,
Geerten
On Tuesday, February 19, 2013 3:35:53 PM UTC+1, [email protected] wrote:
>
> Hi,
>
> I would like to do the following,
>
> 1) Have regular .html .css & .js files just like a normal web app
>
> 2) Interact with Node Js only through Ajax calls
>
> 3) But All files mentioned in 1) are also hosted on the same Node Http
> server.
>
> So when I say http://localhost:3000/index.html, Node Js server should
> give me index.html along with all css & js files included in it.
>
> Then my Javascript & Ajax code should drive the functionality with Node
> program getting called by ajax request.
>
> Can anyone please please suggest me the best way to do this ?
>
> I don't want to use Jade or Stylus. I want to develop as if I am using
> tomcat or wamp server & use power of Node where ever needed only.
>
> I am aware of express js framework but don't know how it will be useful
> for above scenario.
>
--
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.