Skip to content

Instantly share code, notes, and snippets.

Stephany Henrique Batista StephanyBatista

Block or report user

Report or block StephanyBatista

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.js
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var load = require('express-load');
var session = require('express-session');
var passport = require('./lib/passport');
View home.js
module.exports = function(app){
var controller = app.controllers.home;
app.use('/', controller.index);
app.use('/logon', controller.logon);
}
View home.js
module.exports = function(app){
var homeController = {
index: function(request, response){
response.render('home/index', {title: 'teste'});
},
logon: function(request, response){
View gist:3a2bfdd9aa3f9b7d170f
//app.js
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var load = require('express-load');
var session = require('express-session');
@StephanyBatista
StephanyBatista / basicServerWeb.js
Last active Oct 10, 2015
How create a server web
View basicServerWeb.js
var http = require('http');
var atendeRequisicao = function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write("<h1>Hello World!</h1>");
response.end();
}
var server = http.createServer(atendeRequisicao);
@StephanyBatista
StephanyBatista / basicServerWeb.js
Last active Oct 10, 2015
How create a server web with routes
View basicServerWeb.js
var http = require('http');
var atendeRequisicao = function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
if(request.url == '/')
response.write("<h1>Home</h1>");
else if(request.url == '/sobre')
response.write("<h1>Sobre</h1>");
else if(request.url == '/contato')
View app.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
View basicServerWeb.js
var http = require('http');
var newRequest = function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write("<h1>Hello World!</h1>");
response.end();
}
var server = http.createServer(newRequest);
@StephanyBatista
StephanyBatista / basicServerWeb.js
Created Jan 11, 2016
How create a server web with routes
View basicServerWeb.js
var http = require('http');
var newRequest = function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
if(request.url == '/')
response.write("<h1>Home</h1>");
else if(request.url == '/sobre')
response.write("<h1>About</h1>");
else if(request.url == '/contato')
You can’t perform that action at this time.