/*******************************
* Import Required Modules
****************************/
var express = require('express');
var bodyParser = require('body-parser');
var session = require('express-session');
var path = require("path")
var app = express();
app.use(bodyParser());
app.use(bodyParser.json({limit: '10mb'}));
app.use(bodyParser.urlencoded({limit: '10mb', extended: true, parameterLimit:50000}));
var MemoryStore = session.MemoryStore;
var sessionStore = new MemoryStore();
app.use(session({store:sessionStore, secret: 'secret', key: 'express.sid', cookie: { path: '/', httpOnly: true, maxAge: 8*60*60*1000} }));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
var server = require('http').Server(app);
server.listen(8080);
Socket.IO enables real-time bidirectional event-based communication. It works on every platform, browser or device, focusing equally on reliability and speed. Real-time analytics Push data to clients that gets represented as real-time counters, charts or logs. Binary streaming Starting in 1.0, it's possible to send any blob back and forth: image, audio, video. Instant messaging and chat Socket.IO's "Hello world" is a chat app in just a few lines of code. Document collaboration Allow users to concurrently edit a document and see each other's changes. USED BY EVERYONE From Microsoft Office, Yammer, Zendesk, Trello... to hackathon winners and little startups. One of the most powerful JavaScript frameworks on GitHub, and most depended-upon npm module. IMMENSELY POWERFUL, YET EASY TO USE Our getting started guide will show you how to create lots of amazing applications in fewer than 200 lines of code.
Comments
Post a Comment