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'); | |
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'); |
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
module.exports = function(app){ | |
var controller = app.controllers.home; | |
app.use('/', controller.index); | |
app.use('/logon', controller.logon); | |
} |
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
module.exports = function(app){ | |
var homeController = { | |
index: function(request, response){ | |
response.render('home/index', {title: 'teste'}); | |
}, | |
logon: 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
//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'); |
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 atendeRequisicao = function(request, response) { | |
response.writeHead(200, {"Content-Type": "text/html"}); | |
response.write("<h1>Hello World!</h1>"); | |
response.end(); | |
} | |
var server = http.createServer(atendeRequisicao); |
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 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') |
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'); | |
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; |
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
npm install express-generator -g |
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 newRequest = function(request, response) { | |
response.writeHead(200, {"Content-Type": "text/html"}); | |
response.write("<h1>Hello World!</h1>"); | |
response.end(); | |
} | |
var server = http.createServer(newRequest); |
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 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') |
OlderNewer