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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset = "UTF-8"/> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<h1>Bunny Server retrieved the Homepage!</h1> | |
<h2 class="see-me" style="color: white">If the css file is working you should see this.</h2> | |
<img src="http://weknowmemes.com/wp-content/uploads/2013/03/easter-bunny-meme-eggs.jpg" |
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 fs = require('fs'); | |
// STEP #2.4 Let's serve actual files! Uncomment below: | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
// If it's a GET request: | |
if(req.method === 'GET') { | |
// and if the GET request is the homepage: | |
if (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 http = require('http'); | |
// STEP #2.3 Let's configure two URLs to GET requests | |
// Uncomment below: | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
// If it's a GET request: | |
if(req.method === 'GET') { | |
// and if the GET request is the homepage: | |
if (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 http = require('http'); | |
// STEP #2.2 Let's print the request headers from the request object. Uncomment below: | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
// printing the request headers! | |
console.log(req.headers); | |
// lets access the 'connection' property inside the headers object: | |
console.log("ACCESSING HEADER:", req.headers['connection']); | |
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'); | |
// STEP #2.1 Let's print the request url method | |
//from the request object. Uncomment below: | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
// printing the request url! | |
console.log(req.url); | |
// printing the request method! | |
console.log(req.method); |
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'); | |
// STEP #2 Let's print the request object: | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
res.writeHead(200); | |
res.end('<html><body><h1>Bunny Server is live!</h1><img src="https://cdn.meme.am/instances/400x/55347780.jpg"></body></html>') | |
// printing the request object! | |
console.log(req); |
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
if (req.url === '/') { | |
res.setHeader('Content-Type', 'text/html'); | |
res.setHeader('BrigadierFluffykins', 'isAwesome'); | |
res.setHeader('BunnyBunny', 'OhYeah'); | |
res.end('<html><body><h1>Bunny Server retrieved the Homepage!</h1><img src="http://weknowmemes.com/wp-content/uploads/2013/03/easter-bunny-meme-eggs.jpg"></body></html>') | |
} |
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
// First require in the EventEmitter Object | |
var EventEmitter = require('events').EventEmitter; | |
// Create a new instance of the EventEmitter | |
var bunnyError = new EventEmitter(); | |
// This is where you create your bunnyError event | |
// and create a callback that will be triggered when | |
// bunnyError is called | |
bunnyError.on('bunnyWarning', function(warning) { | |
console.log(`BUNNY WARNING: ${warning}`); |
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'); | |
// STEP #1.5 Basic Server Continued... | |
var bunnyServer = http.createServer(); | |
bunnyServer.on('request', function(req, res) { | |
res.writeHead(200); | |
res.end('<html><body><h1>Bunny Server is live!<br /><img src="https://cdn.meme.am/instances/400x/55347780.jpg"></h1></body></html>'); | |
}).listen(3000); |
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
.divs { | |
margin: auto; | |
padding: 30px; | |
width: 50%; | |
margin-bottom: 5px; | |
border: solid grey 1px; | |
} | |
#btn { | |
padding: 15px 63px; |
NewerOlder