Skip to main content

Posts

Showing posts from 2014

Node.js Module for Adobe Behance Portfolio development API's- node-behance-api

Node.js module for Adobe Behance Portfolio development API's Behace is an online portfolios website. Here an user can create and watch his portfolios. node-behance-api is an utility wrapper for Adobe Behance rest services for node.js. This utility is developed for node.js only. Currently it supports all of the API's of Adobe Behance. You can update and add other api by simple coding. Before starting development on node. You have to register your app on https://www.behance.net/dev/register . Register your app and get the client id from there. *This utility wrapper uses request module. Installation $ npm install node-behance-api Requirement request - npm https://www.npmjs.org/package/request examples: var Behance = require ( "node-behance-api" ); var behance = new Behance({ "client_id" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }) Behance.initOptions(); behance.get(Behance.APIS.GET_USER, {    user: 'deepakmshrma' }, f

Provide SSL support over your http NodeJs-Express API

A simple HTTPS server using node.js: Using ExpressJS and openssl, you can easily provide SSL support to your Api. For that you have to follow below given steps. Steps to create a https server. Generate an SSL certificate with that key Create a app.js file Install express module Run to Test your app. :-) Generate an SSL certificate with that key: For development purposes you can create a self-certified certificate. First, generate a private key on linux-based system. It will store a 1024 bit RSA key in the file key.pem openssl genrsa 1024 > key.pem Then, generate an SSL certificate with that key: openssl req -x509 -new -key key.pem > key-cert.pem Create a app.js file var fs = require("fs"),                 //Requires fs module to read key, cert files     express = require('express'),       // call express     app = express(),                     // define our app using express     http = require("http"),         

Simple HTTP server programm in NodeJs

Most common use of Node is to create a servers. Node gives you very simple way to create different type of servers. Here using a Node i will create a simple HTTP server which will listen a port and response simple text message to every client which try to connect this HTTP server. Create a httpserver.js: var http = require('http'); var server = http.createServer(); server.on('request', function (req, res) {     res.writeHead(200, {'Content-Type': 'text/plain'});     res.end('Hello NodeJs Ninja\n'); }); server.listen(3000); console.log('Server running at http://localhost:3000/'); Explanation: Here what we have did. we have created a simple HTTP server which is listening port 3000 of your local server. Whenever a request happens, the anonymous [ 3 ] function (req, res) callback is fired and “Hello NodeJs Ninja” is written out as the response. You can compare it with the onclick event of the browser. Whenever user click on some ele

Simple Example of Nodejs- My First Nodejs Programm

In this section, our plan is to lead you into the world of Nodejs programming by taking you through the two basic steps required to get a simple program running. As with any application, you need to be sure that Nodejs[1] is properly installed on your computer. You also need an editor (I will suggest sublime[2] editor) and a terminal application.  Programming in Nodejs.  We break the process of programming in Nodejs into two steps:     Create the program by typing it into a text editor and saving it to a file named, say, app.js.     Run (or execute) it by typing "node app.js" in the terminal window. Creating a Nodejs program. A program is nothing more than a sequence of characters, like a sentence, a paragraph, or a poem. To create one, we need only define that sequence characters using a text editor in the same way as we do for e-mail. app.js is an example program. Type these character into your text editor and save it into a file named app.js. Create a resource.j