Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An entire website with node.js and mongodb?

I've build several websites using PHP and mySQL as backend, and believe that I'm fairly familiar with both. However during research for my new website I've come across node.js and mongodb (and socket.io, since the site is gonna contain a chat).

I've decided to use node.js and mongodb to run the chat - but don't know if I should just do the entire site with those two things? Since I'm gonna run a node server anyway should I just run another (seperate) one hosting the website? Or is that an bad idea? - is it stable? I could do the programming in PHP and still be using mongodb - but wouldn't node be way faster?

And another question: I've planned to use ajax to handle all the posts to the page - but since I'm allready using socket.io to the chat - should I do all my post request using that? For the ajax I've planned to use jQuery (also for all frontend effects).

like image 597
jack Avatar asked May 05 '11 22:05

jack


People also ask

Can I build a whole website using node JS?

Yes, you create the whole web server in node. js and use it to serve all your web pages. Typically one might use a number of libraries with node. js such as Express for mapping all the routes in your web app and your favorite template engine to help with filling in data in HTML pages before serving them to the client.

Is MongoDB good for node JS?

Node and MongoDB work very-well together, in part because Mongo uses a JavaScript engine built into the database since JavaScript is good at handling JSON objects. Compared to other databases, such as MySQL, MongoDB is fast for storing certain types of data and can be automatically scaled.

Is Node JS good for website?

Using Node. js for web app development is one of the best options for large organisations as it's fast and scalable. As it runs on the V8 engine it is very fast in terms of computing speed which can in turn increase traffic on the web and mobile portals.


1 Answers

don't know if I should just do the entire site with those two things?

If you want to learn node.js then there is nothing better than coding it.

Since I'm gonna run a node server anyway should I just run another (seperate) one hosting the website?

You can use existing server and run your node.js app on other free port(o). I think for learning node you don't need to have dedicated machine.

is it stable?

Even versions of node.js are stable releases, however until there is 1.0 with feature freeze there could be breaking changes to its API.

I could do the programming in PHP and still be using mongodb - but wouldn't node be way faster?

It most probably (and definitely) would.

I've planned to use ajax to handle all the posts to the page - but since I'm allready using socket.io to the chat - should I do all my post request using that?

I would recommend stick to MVC model and use express since you can get into lot of time consuming troubles if you would use socket.io for classic stuff. Socket.io is namely for real-time functionality and things related to that.

like image 78
yojimbo87 Avatar answered Oct 07 '22 16:10

yojimbo87