This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
sys = require('sys'), | |
fs = require('fs'), | |
ws = require('./ws.js'); | |
var clients = []; | |
http.createServer(function(request, response) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'), | |
http = require('http'); | |
http.createServer(function (req, res) { | |
switch (req.url) { | |
case '/': | |
res.writeHead(200, {'Content-type': 'text/html'}); | |
res.end( | |
'<form action="/myaction" method="post" enctype="multipart/form-data">'+ | |
'<input type="text" name="field1">' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, crypto = require('crypto'); | |
var app = module.exports = express(); | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser('shhhh, very secret')); | |
app.use(express.session()); | |
app.set('view engine', 'ejs'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
// set up some routes | |
switch(req.url) { | |
case '/': | |
// show the user a simple form | |
console.log("[200] " + req.method + " to " + req.url); | |
res.writeHead(200, "OK", {'Content-Type': 'text/html'}); | |
res.write('<html><head><title>Hello Noder!</title></head><body>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
// set up some routes | |
switch(req.url) { | |
case '/': | |
// show the user a simple form | |
console.log("[200] " + req.method + " to " + req.url); | |
res.writeHead(200, "OK", {'Content-Type': 'text/html'}); | |
res.write('<html><head><title>Hello Noder!</title></head><body>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
http.createServer(function (req, res) { | |
// set up some routes | |
switch(req.url) { | |
case '/': | |
// show the user a simple form | |
console.log("[200] " + req.method + " to " + req.url); | |
res.writeHead(200, "OK", {'Content-Type': 'text/html'}); | |
res.write('<html><head><link rel="stylesheet" type="text/css" href="style.css"><title>Hello Noder!</title></head><body>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var querystring = require('querystring'); | |
var util = require('util'); | |
http.createServer(function (req, res) { | |
// set up some routes | |
switch(req.url) { | |
case '/': | |
// show the user a simple form | |
console.log("[200] " + req.method + " to " + req.url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
module.exports.mongoose = mongoose; | |
module.exports.Schema = Schema; | |
//Connect to cloud database | |
var username = "Dileep" | |
var password ="******"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var db = require('../lib/db'); | |
var UserSchema = new db.Schema({ | |
username : {type: String, unique: true} | |
, password : String | |
}) | |
var MyUser = db.mongoose.model('User', UserSchema); | |
// Exports | |
module.exports.addUser = addUser; | |
// Add user to database | |
function addUser(username, password, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
, app = express() | |
, fs = require('fs'); | |
// Routes | |
app.get('/form', function(req, res) | |
{ | |
fs.readFile('./form.html', function(error, content) | |
{ |
OlderNewer