Posts

Showing posts with the label Node js

Express.js Web Application

Image
Express.js Web Application: In this section, you will learn how to create a web application using Express.js. Express.js provides an easy way to create web server and render HTML pages for different HTTP requests by configuring routes for your application. Web Server: First of all, import the Express.js module and create the web server as shown below. app.js: Express.js Web Server var express = require( 'express' ); var app = express(); // define routes here.. var server = app.listen(5000, function () { console.log( 'Node server is running..' ); }); In the above example, we imported Express.js module using require() function. The express module returns a function. This function returns an object which can be used to configure Express application (app in the above example). The app object includes methods for routing HTTP requests, configuring middleware, rendering HTML views and registering a template engine. The app.listen() fun

Generate image ,pdf and Video Thumb using node js

      Using  imagemagick  Generate image thumb                 var im = require( 'imagemagick' );         var image = random() + '.png' ;         var imagepath = 'uploads/images_thumb/' + image;         var pathToFile = path.join(__dirname, req.files[i].path),             pathToSnapshot = path.join(__dirname, '/' + imagepath);         im.resize({             srcPath: pathToFile               , dstPath: pathToSnapshot               , width: 150               , height: 150               , quality: 0               , gravity: "North"         }, function (err, stdout, stderr) {             if (err) {                 console.log(err);             }             console.log( 'resized image ' , pathToSnapshot);             //res.json(pathToSnapshot);         });     Using Gm  Generate Pdf thumb                 var gm = require( 'gm' );       var image = random() + '.p

Private Chat Using Node js and socket.io with encrypt and decrypt message and insert into mongo db

node.js and socket.io chat tutorial This is a very simple single-room chat client using node.js, socket.io and the express module. i found that the ready availability of  documentation  and the eagerness of experienced individuals to help the newly adopting, throughout the  node.js  communities, allow for quicker learning and sharing of acquired skills UPDATE:  long overdue, but you can now skip the following step and just install via the .msi or .pkg files and they include NPM –  http://nodejs.org/#download to begin, you must install node.js and npm along with their dependencies in Linux System now, install the modules curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs For Update  sudo apt-get purge node-express now, install the modules npm install -d let’s now create the server file, server .js var express = require( 'express' ); var app = express(); var server = require( 'http' ).cr