Skip to content

Instantly share code, notes, and snippets.

View pandeysoni's full-sized avatar
🎯
Focusing

Soni Pandey pandeysoni

🎯
Focusing
  • India
View GitHub Profile
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Welcome to node.js World");
response.end();
}).listen(9000);
var http = require("http");
function onRequest(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Welcome to node.js World");
response.end();
}
http.createServer(onRequest).listen(9000);
var http = require("http");
function onRequest(request, response) {
console.log("Request received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Welcome to node.js World");
response.end();
}
http.createServer(onRequest).listen(9000);
var http = require("http");
function onRequest(req, res) {
if (req.url == "/") {
res.writeHead(200, { "Content-Type": "text/html" });
res.end("Welcome to the homepage!");
}
// About page
else if (req.url == "/contact") {
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('welcome to home page!');
});
app.get('/about', function (req, res) {
res.send('welcome to about page!');
});
'use strict';
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* @module company
* @description contain the details of company information, conditions and actions.
*/
'use strict';
var Company = require('../model/company').Company;
/** create function to create Company. */
exports.create = function (req, res) {
Company.create(req.body, function(err, result) {
if (!err) {
return res.json(result);
} else {
'use strict';
//Start by defining the main module and adding the module dependencies
angular.module(ApplicationConfiguration.applicationModuleName, ApplicationConfiguration.applicationModuleVendorDependencies);
// Setting HTML5 Location Mode
angular.module(ApplicationConfiguration.applicationModuleName).config(['$locationProvider',
function($locationProvider) {
$locationProvider.html5Mode({
enabled: true,
'use strict';
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function() {
// Init module configuration options
var applicationModuleName = 'nodeapp';
var applicationModuleVendorDependencies = ['ngResource', 'ui.router', 'angular-growl'];
// Add a new vertical module
var registerModule = function(moduleName, dependencies) {
<!-- index.html -->
<!doctype html>
<!-- ASSIGN OUR ANGULAR MODULE -->
<html >
<head>
<!-- META -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"><!-- Optimize mobile viewport -->
<base href="/">