0

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)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Daniel O.
  • 196
  • 2
  • 16
  • node.js would be used on the backend side for the api. On the frontend side you can use something like meteor js which was developed with realtime data in mind. – blacksheep_2011 Jan 30 '16 at 20:47

2 Answers2

0

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.

Duane
  • 4,460
  • 1
  • 25
  • 27
  • Ok thanks but I would like to create an realtime Application with much Traffic so is nodejs and socketio the right way – Daniel O. Jan 31 '16 at 08:41
0

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/