Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Node.js a good alternative to build complete websites?

Tags:

I'm wondering if using Node.js (express.js) is the best option to go for a complete website. I've been using Rails + Node.js and am wondering if this is still the best option or if I should move completely to Node.js.

Are there websites built completely with node.js? I imagine it must lack many things Rails offers.

like image 892
donald Avatar asked Jun 19 '11 19:06

donald


People also ask

Is NodeJS enough for Web development?

If you are looking for real-time web apps, then Node. js might be the best choice for Back-end development as it has all the above features which is very great in delivering excellent performance. It is built on a single-threaded, non-blocking event loop, Google V8 engine and low-level API.

Is node good for websites?

Node. js made JavaScript a full-stack technology of choice for web application development. Due to its non-blocking architecture, Node. js works well for encoding and broadcasting video and audio, uploading multiple files, and data streaming.

Can I build a website with NodeJS?

js is a popular choice for writing back-end code. In this tutorial, you will learn how to build web servers using the http module that's included in Node. js. You will build web servers that can return JSON data, CSV files, and HTML web pages.

What is NodeJS not good for?

Node. js doesn't support multi-threaded programming yet. It is able to serve way more complicated applications than Ruby, but it's not suitable for performing long-running calculations. Heavy computations block the incoming requests, which can lead to decrease of performance .


2 Answers

I imagine it must lack many things Rails offers.

I gave a short list below but I would like to know what you could be missing and I think(almost certain) we can give you some alternatives on node.js.


Modules

node.js is getting pretty complete and I think you can run your entire site using only node.js using for example the following modules. I assume you know about npm. If not I really advice you to google for it and learn that. To search npm you can use http://search.npmjs.org:

web framework:

  1. High performance, high class web development for Node.js
    https://github.com/visionmedia/express

  2. Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms. https://github.com/learnboost/socket.io-node

I believe with these two web-frameworks you can create a lot of sites. For example express is a very powerfull web framework and supports a lot of cool things like:

  • session support.
  • a lot powerful template engines. I like Jade for example. You could also share these between client and server a lot of the times easily.
  • excellent routing.

just to name a few.

database:

  1. Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
    https://github.com/mranney/node_redis

  2. MongoDB (from "humongous") is a scalable, high-performance, open source, document-oriented database. Mongoose is a MongoDB object modeling tool designed to work in an asychronous environment.
    https://github.com/learnboost/mongoose/

With those two databases I think you should be able to accomplish most of your tasks. The nice thing is that Redis is extremely fast/simple advanced KV-store(dataset in memory/also supports VM) and supports replication while Mongodb is more completely(slower then redis) and also supports sharding.

authentication:

  1. Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps.
    https://github.com/bnoguchi/everyauth

Like I said previously you can get a long way with only these modules.

like image 117
Alfred Avatar answered Sep 23 '22 13:09

Alfred


Express.js is more akin to Sinatra. They're simpler frameworks than rails.

Express's list of sites is fairly small http://expressjs.com/applications.html

So I think it's also good to look at Sinatra's list http://www.sinatrarb.com/wild.html

So to answer your questions in reverse order. Yes it lacks all the features of rails. Yes there are sites written completely in Express. And going to 100% Node.js might be the right decision for your site.

It depends on which features you'd miss and what performance you need.

like image 40
generalhenry Avatar answered Sep 23 '22 13:09

generalhenry