website - Realtime Application

121 Views Asked by At

I would like to create an website with much realtime traffic. So my question is:

Is node.js and socket.io the right way?

(I'm ready to learn and have a good knowledge at PHP,JQUERY,JS,CSS,MYSQL and VB.NET)

2

There are 2 best solutions below

1
Duane On

Node is a great language and if you like Javascript already, I believe it can be a great language to learn. The simplest way to get a simple web server up and running is Express (http://expressjs.com/). With express you can start a server and serve static content (your html pages).

Here is a quick guide to get started in Node.js

  1. Install Node
  2. Create a directory from which to work in
  3. Run npm init
  4. Answer the questions in the prompts
  5. Install Express npm install --save express
  6. Create a file called app.js
  7. Copy the following code into the file:

    'use strict';
    const express = require('express');
    const app = express();
    const HTTP_PORT = 3000;
    
    app.use(express.static('public'));
    
    app.listen(HTTP_PORT);
    console.log('Listening on port: ' + HTTP_PORT + ' -- Open http://localhost:' + HTTP_PORT);

  1. Make a folder named 'public'
  2. Create a new HTML file called index.html
  3. Add some content
  4. Start your node server with node app.js
  5. Open a browser to http://localhost:3000

Congratulations, you now have a real working node server, that serves static content and can handle ajax requests!

There is a ton of info I could put next, but I recommend checking out the express documentation to find how to handle routing and api requests.

Good luck and happy learning!

If you want a shortcut, I threw together a tiny starter pack of code that does all of the following and includes an API request example. https://github.com/DuaneGarber/nodeExpressStarter

Simply pull down the code, npm install, then start the server node app.js, open localhost:3000 in a browser.

0
samnaikwade On

If you have good or fair knowledge of javascript then you should go for Meteor.

Meteor

https://www.meteor.com/

Sample tutorial you should start with

http://meteortips.com/first-meteor-tutorial/