1

I'd like to use node.js to add basic functionality to a static site:

  • user authentication and permissions
  • basic content management (archiving, tags, search)

The examples at nodejs.org show how to start a server, written in JS, but coding an entire http server seems to be an overkill, and definitely doesn't strike me as a very secure solution. Is this really necessary when a standard web server can be used?

What would be the most straightforward way of integrating node.js code behind a server like nginx?

2
  • Not sure if you really need to use NodeJS for your requirement. Can you post some more details about what you are trying to build? Commented Aug 5, 2013 at 8:39
  • I'd like to use node for user authentication, setting permissions, archiving content and possibly site-wide search. Ideally, I want to add these features in a modular fashion with the minimum amount of code necessary. Commented Aug 5, 2013 at 9:20

2 Answers 2

1

If you don't know you need node.js then you probably don't. Node is really meant for real-time applications and highly available and dynamic content being accessed thousands of times per second. For what it sounds like you are making it might be best to use a less efficient but easier solution from the Ruby side. Ruby is super easy to learn and has many great beginner documents. Specifically look into Ruby on Rails and Sinatra.

Another more practical option would be to skip all of this and just use Wordpress. I work for a web development company and 90% of sites end of being wordpress, even the dynamic ones. Wordpress has a huge library of plugins and apis to allow for ultra-customizability. For Wordpress' true power it is best to use a private hosting of it from wordpress.org rather than a shared hosting like wordpress.com.

Sign up to request clarification or add additional context in comments.

3 Comments

I know that node is ideal for asynchronous apps, but it is also a great platform for the future, and is built around a language I can use right now (JS). If the Express framework can be fairly easily implemented, it is a much more practical solution than learning Ruby from scratch... A CMS is completely out of the question due to bloated code and poor scalability.
If you feel comfortable with node then definitely give it a try. I can give few recommendations as to what libraries to use, but when it comes to security that is entirely dependent on the environment you are in. Check out the following libraries for scalability. Flatiron will probably be the most familiar to a front-end javascript user and it can be on the server and in the browser!
Flatiron looks promising, but I guess it will come down to trial and error. Unfortunately, due to the lack of more comprehensive node.js tutorials and books, it is very hard to determine what the learning curve would be as opposed to going with a better documented language and framework like RoR. I am willing to bet on node.js, but I am torn between uncertainty and potentially a lot of wasted time. :(
1

You can use Apache and Node.js at the same time, on different ports.

Let Apache handle HTTP, and use Node.js on other port to handle your chat, or your real time notification system or whatever you want to do with Node.js

You don't have to use Node.js to serve HTML if you don't want to do so. In fact it's not a good idea, unless you really expect a benefit (because your server will handle tons if IO or if you have such a small/simple web that you don't need a monster like Apache behind).

1 Comment

My site is mainly static content, but I need to create user classes and control content access. Some blog-like functionality would also be great to improve usability. I don't expect concurrency to be a big issue, and nginx should be perfectly fine for handling the load. Node allows me to use only Javascript so it is much more practical than learning new languages/frameworks. Not much beginner-level information is available though. :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.