diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index abd644d..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-
-# Runtime data
-pids
-*.pid
-*.seed
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (http://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directory
-# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
-node_modules
-
-# Optional npm cache directory
-.npm
-
-.DS_Store
diff --git a/craig_campbell/README.md b/README.md
similarity index 92%
rename from craig_campbell/README.md
rename to README.md
index ed84eb4..82f1087 100644
--- a/craig_campbell/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+Vanilla HTTP Server
+===========================
To complete this assignment:
* fork this repository (the sub module for this specific assignment)
* clone down your fork
@@ -9,17 +11,17 @@ To complete this assignment:
Assingment Description
---------------------------
For this assignment you should write an http server in vanilla node that responds to several different routes.
+
The server should respond to a request to /time that will send back the current time of the server.
- * It should also respond to a get request to /greet/name where name is any single word string.
+ * It should also respond to a get request to /greet/name where name is any single word string.
* It should send back a string that greets that name.
* It should also have a separate post request to /greet that takes the name in JSON format.
* There should be tests using chaiHTTP for both routes, as well as a gulpfile/package.json
* You should have an html page that describes the routes implemented by the api available at the root of the server
-
+
Rubric:
* Tests: 4pts
* Routes: 4pts
* Organization and gulpfile/package.json 2pts
-
diff --git a/ansoo_chang/.gitignore b/ansoo_chang/.gitignore
deleted file mode 100644
index abd644d..0000000
--- a/ansoo_chang/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-# Logs
-logs
-*.log
-npm-debug.log*
-
-# Runtime data
-pids
-*.pid
-*.seed
-
-# Directory for instrumented libs generated by jscoverage/JSCover
-lib-cov
-
-# Coverage directory used by tools like istanbul
-coverage
-
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (http://nodejs.org/api/addons.html)
-build/Release
-
-# Dependency directory
-# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
-node_modules
-
-# Optional npm cache directory
-.npm
-
-.DS_Store
diff --git a/ansoo_chang/lib/server.js b/ansoo_chang/lib/server.js
deleted file mode 100644
index 3f5d995..0000000
--- a/ansoo_chang/lib/server.js
+++ /dev/null
@@ -1,27 +0,0 @@
-var http = require('http');
-var fs = require('fs');
-// var ReadStream = require('stream').Readable;
-
-/*
-req is an object containing information about the HTTP request that raised the event. In response to req, you use res to send back the desired HTTP response.
-*/
-
-var server = http.createServer(function(req, res) {
- var resData = {}
- if (req.url === '/' && req.method === 'GET') {
- resData.status = 200;
- resData.contentType = 'text/html';
- resData.data = fs.readFileSync(__dirname + '/public/index.html').toString();
- }
-
- // res.writeHead({
- // status: resData.status || 400,
- // 'Content-Type': resData.contentType || 'text/plain'
- // });
-
-
-});
-
-server.listen(3000, function() {
- console.log('server up!');
-});
diff --git a/ansoo_chang/package.json b/ansoo_chang/package.json
deleted file mode 100644
index eb6698e..0000000
--- a/ansoo_chang/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "name": "httpserver",
- "version": "1.0.0",
- "description": "create an http server",
- "main": "index.js",
- "directories": {
- "test": "test"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "",
- "license": "MIT",
- "devDependencies": {
- "chai": "^3.4.0",
- "chai-http": "^1.0.0",
- "gulp": "^3.9.0",
- "gulp-jshint": "^1.12.0",
- "gulp-mocha": "^2.1.3",
- "mocha": "^2.3.3"
- }
-}
diff --git a/ansoo_chang/public/index.html b/ansoo_chang/public/index.html
deleted file mode 100644
index 9ab70b9..0000000
--- a/ansoo_chang/public/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Test
-
-
-
Test!
-
-
This is a test!
-
-
-
diff --git a/ansoo_chang/public/time.html b/ansoo_chang/public/time.html
deleted file mode 100644
index d3e9e66..0000000
--- a/ansoo_chang/public/time.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- Time
-
-
-
-
-
-
-
-
-
diff --git a/ansoo_chang/server.js b/ansoo_chang/server.js
deleted file mode 100644
index 988bca5..0000000
--- a/ansoo_chang/server.js
+++ /dev/null
@@ -1,52 +0,0 @@
-var http = require('http');
-var fs = require('fs');
-var url = require('url');
-
-/*
-req is an object containing information about the HTTP request that raised the event. In response to req, you use res to send back the desired HTTP response.
-*/
-
-var server = http.createServer(function(req, res) {
- // create response data object
- var resData = {}
- var name = req.url.split('/')[2];
- var queryObj = url.parse(req.url, true)
-
- if (req.url === '/' && req.method === 'GET') {
- resData.status = 200;
- resData.contentType = 'text/html';
- resData.data = fs.readFileSync(__dirname + '/public/index.html').toString();
- }
-
- // respond to a request to /time that will send back the current time of the server.
- if (req.url === '/time' && req.method === 'GET') {
- resData.status = 200;
- resData.contentType = 'text/html';
- resData.data = new Date().toString();
- }
-
- // respond to a get request to /greet/name and send back a string that greets that name
- if (req.url === '/greet/' + name && req.method === 'GET') {
- resData.status = 200;
- resData.contentType = 'text/html';
- resData.data = 'Hello ' + name;
- }
-
- // post request to /greet that takes the name in JSON format
- if (req.url === '/greet/' + name && req.method === 'POST') {
- resData.status = 200;
- resData.contentType = 'application/json';
- resData.data = JSON.stringify({Hello: name});
- }
-
- res.writeHead(resData.status || 400, {
- 'Content-Type': resData.contentType || 'text/plain'
- });
-
- res.write(resData.data || 'not found');
- res.end();
-});
-
- server.listen(3000, function() {
- console.log('server up!');
-});
diff --git a/ansoo_chang/test/server_test.js b/ansoo_chang/test/server_test.js
deleted file mode 100644
index f77a4ab..0000000
--- a/ansoo_chang/test/server_test.js
+++ /dev/null
@@ -1,25 +0,0 @@
-var chai = require('chai');
-var chaihttp = require('chai-http');
-chai.use(chaihttp);
-var expect = chai.expect;
-var fs = require('fs');
-require(__dirname + '/../server.js');
-
-describe('http server', function() {
- before(function() {
- this.indexFileString = fs.readFileSync(__dirname + '/../public/index.html').toString();
- });
-
- it('should be able to get an index', function(done) {
- chai.request('localhost:3000')
- //debugger;
- .get('/')
- .end(function(err, res) {
- // debugger;
- expect(err).to.eq(null);
- expect(res).to.have.status(200);
- expect(res.text).to.eql(this.indexFileString);
- done();
- }.bind(this));
- });
-});
diff --git a/craig_campbell/gulpfile.js b/craig_campbell/gulpfile.js
deleted file mode 100644
index 48eac2e..0000000
--- a/craig_campbell/gulpfile.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var gulp = require('gulp');
-var jshint = require('gulp-jshint');
-var mocha = require('gulp-mocha');
-
-gulp.task('default', ['jshint', 'test']);
-
-gulp.task('jshint', function(){
- gulp.src(['gulpfile.js', 'index.js', 'test/*.js', 'lib/*.js'])
- .pipe(jshint())
- .pipe(jshint.reporter('jshint-stylish'));
-});
-
-gulp.task('test', ['jshint'], function(){
- gulp.src('test/*test.js')
- .pipe(mocha({reporter: 'nyan'}));
-});
diff --git a/craig_campbell/index.js b/craig_campbell/index.js
deleted file mode 100755
index e89a6c0..0000000
--- a/craig_campbell/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env node
-
-var start = require(__dirname + '/lib/http-server.js');
diff --git a/craig_campbell/lib/dateinfo.js b/craig_campbell/lib/dateinfo.js
deleted file mode 100644
index 7b236a8..0000000
--- a/craig_campbell/lib/dateinfo.js
+++ /dev/null
@@ -1,64 +0,0 @@
-'use strict';
-// a library of sorts, written by Craig Campbell (craig.campbell8@gmail.com)
-
-module.exports = exports = {
-
- newDate : function() {
-
- return new Date().toString();
- },
-
- getTheYear: function() {
-
- return new Date().getFullYear().toString();
- },
-
- getTheMonth: function(){
-
- var month = (new Date().getMonth() + 1).toString(); // add 1 because months go from 0-11 not 1-12
- if ( Number(month) < 10) {
- month = "0" + month;
- }
- return month.toString();
- },
-
- getTheDay: function() {
-
- var day = new Date().getDate().toString();
- if ( Number(day) < 10) {
- day = "0" + day;
- }
- return day.toString();
- },
-
- getTheHours: function() {
-
- var hours = new Date().getHours().toString();
- if ( Number(hours) < 10) {
- hours = "0" + hours;
- }
- return hours.toString();
-
- },
-
- getTheMinutes: function(){
-
- var minutes = new Date().getMinutes().toString();
- if ( Number(minutes) < 10) {
- minutes = "0" + minutes;
- }
- return minutes.toString();
- },
-
- getTheSeconds: function(){
-
- var seconds = new Date().getSeconds().toString();
- if ( Number(seconds) < 10) {
- seconds = "0" + seconds;
- }
- return seconds.toString();
-
- }
-
- };
-
diff --git a/craig_campbell/lib/http-server.js b/craig_campbell/lib/http-server.js
deleted file mode 100644
index 274c104..0000000
--- a/craig_campbell/lib/http-server.js
+++ /dev/null
@@ -1,62 +0,0 @@
-'use strict';
-
-var dateinfo = require('./dateinfo.js');
-var fs = require('fs');
-var http = require('http');
-var port = 3000;
-
-var server = http.createServer(function(req, res){
- var name = req.url.slice(7);
-
- if (req.method === 'GET' && req.url === '/') {
- fs.readFile(__dirname + '/../public/index.html', function(err, data){
- res.writeHead(200, {'Content-Type' : 'text/html'});
- if (err) return console.log(err);
- res.write(data, 'utf-8');
- return res.end();
- });
- }
-
- if (req.method === "GET" && req.url === '/time'){
- res.writeHead(200, {
- 'Content-Type' : 'text/plain'
- });
-
- res.write(
- "The current date is: " + dateinfo.getTheMonth() + '-' + dateinfo.getTheDay() + '-' + dateinfo.getTheYear() + ' and the current time is: ' + dateinfo.getTheHours() + ':' + dateinfo.getTheMinutes() + ':' + dateinfo.getTheSeconds() + '.\n\nThis can also be expressed as '+ Date.now().toString() + ' milliseconds since Janury 1, 1970. \n\nAdditionally, this can be expressed as: ' + dateinfo.newDate()
- );
- return res.end();
- }
-
- if (req.method === 'GET' && req.url === '/greet/' + name){
- res.writeHead(200, {
- 'Content-Type' : 'text/plain'
- });
- res.write("Well hello there, " + name);
- return res.end();
- }
-
- if (req.method === "POST" && req.url === ('/greet')){
-
- req.on('data', function(data){
- var parsed = JSON.parse(data.toString());
- console.log(parsed);
- res.writeHead(200, { 'Content-Type' : 'text/plain'});
- res.write('Howdy, ' + parsed.name + '!');
- return res.end();
- });
- }
-
- if ((req.method === 'GET' && req.url !== '/' && req.url !== '/greet/' + name && req.url !== '/time' ) || (req.method === 'POST' && req.url !== '/greet') ){
- res.writeHead(404, {
- 'Content-Type' : 'text/plain'
- });
- res.write("You must be trippin! Ain't no such resource here!");
- res.end();
- }
-
-}); //end createServer
-
-server.listen(port, function(){
- console.log("The server is running on port: ", port);
-});
diff --git a/craig_campbell/package.json b/craig_campbell/package.json
deleted file mode 100644
index 6e8d099..0000000
--- a/craig_campbell/package.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{
- "name": "http-server",
- "version": "1.0.0",
- "description": "simple http server",
- "main": "index.js",
- "directories": {
- "test": "test"
- },
- "scripts": {
- "test": "./node_modules/mocha/bin/mocha test",
- "start": "./index.js",
- "motivator": "echo 'CRAIG, YOU CAN DO IT!'"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/craigaaroncampbell/http-server.git"
- },
- "keywords": [
- "http",
- "server"
- ],
- "author": "craigaaroncampbell@gmail.com",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/craigaaroncampbell/http-server/issues"
- },
- "homepage": "https://github.com/craigaaroncampbell/http-server#readme",
- "devDependencies": {
- "chai": "^3.4.0",
- "chai-http": "^1.0.0",
- "gulp": "^3.9.0",
- "gulp-jshint": "^1.12.0",
- "gulp-mocha": "^2.1.3",
- "jshint-stylish": "^2.0.1",
- "mocha": "^2.3.3"
- }
-}
diff --git a/craig_campbell/public/index.html b/craig_campbell/public/index.html
deleted file mode 100644
index 2ca45e0..0000000
--- a/craig_campbell/public/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- This is basically a README
-
-
-
-A simple HTTP server. GET requests to /greet/[somename] will greet the user by whaterver is typed after /greet/.
-
-GET Requests to /time will give the user the curent time in several formats.
-
-POST requests to /greet will greet the user IF the POST sends JSON in the form '{"name":"[somename]"}' where [somename] is a string.
-
-
-
diff --git a/craig_campbell/test/http-server-test.js b/craig_campbell/test/http-server-test.js
deleted file mode 100644
index e9481c0..0000000
--- a/craig_campbell/test/http-server-test.js
+++ /dev/null
@@ -1,85 +0,0 @@
-var chai = require('chai');
-var expect = chai.expect;
-var fs = require('fs');
-var chaiHttp = require('chai-http');
-
-chai.use(chaiHttp);
-
-require(__dirname + '/../lib/http-server.js');
-
-describe('this server', function(){
-
- before(function(){
- this.indexFileString = fs.readFileSync(__dirname + '/../public/index.html').toString();
- this.name = "kenji";
- this.JSON = {"name": "bob"};
-
- });
-
- it('should respond to root level requests by serving index.html', function(done){
- chai.request('localhost:3000')
- .get('/')
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(200);
- expect(res.text).to.eql(this.indexFileString);
- done();
- }.bind(this));
- });
-
- it('should greet "xxx" someone for requests to /greet/xxx', function(done){
- chai.request('localhost:3000')
- .get('/greet/' + this.name)
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(200);
- expect(res.text).to.eql('Well hello there, ' + this.name);
- done();
- }.bind(this));
-
- });
-
- it('should respond to GET requests to /time', function(){
- chai.request('localhost:3000')
- .get('/time')
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(200);
- done();
- });
-
- });
-
- it('should respond to GET requests at /greet with a 404 (because this route is reserved for POST' , function(){
- chai.request('localhost:3000')
- .get('/greet')
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(404);
- done();
- });
- });
-
- it('should respond to POST requests at /greet when JSON data is sent with a message greeting the value of "name" in the JSON' , function(done){
- chai.request('localhost:3000')
- .post('/greet')
- .send(this.JSON)
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(200);
- expect(res.text).to.eql("Howdy, " + this.JSON.name + '!');
- done();
- }.bind(this));
- });
-
-
- it('should respond with 404 to all other requests', function(done){
- chai.request('localhost:3000')
- .get('/someotherpath')
- .end(function(err, res){
- expect(err).to.eql(null);
- expect(res).to.have.status(404);
- done();
- }.bind(this));
- });
-});
diff --git a/dan_lombardy/index.js b/dan_lombardy/index.js
index 507b0ee..7251440 100644
--- a/dan_lombardy/index.js
+++ b/dan_lombardy/index.js
@@ -5,7 +5,7 @@ var router = require(__dirname + "/lib/router");
var requestHandlers = require(__dirname + "/lib/requestHandlers");
var handle = {};
-var hande = {};
+
handle["/"] = requestHandlers.index;
handle["/index"] = requestHandlers.index;
handle["/server"] = requestHandlers.serverTime;
diff --git a/dan_lombardy/lib/requestHandlers.js b/dan_lombardy/lib/requestHandlers.js
index aed1071..3cf234c 100644
--- a/dan_lombardy/lib/requestHandlers.js
+++ b/dan_lombardy/lib/requestHandlers.js
@@ -1,15 +1,16 @@
"use strict";
+
var querystring = require('querystring');
var fs = require('fs');
-var postedNames = {name: ["billy", "john"]};
+var postedNames = {name: ["billy", "john", "ev"]};
function index(response){
var resData = {};
resData.status = 200;
- resData.contentType = "text.html";
resData.data = fs.readFileSync(__dirname + '/../public/index.html').toString();
+ response.setHeader("Content-Type", "text/html");
response.write(resData.data);
console.log("Index written to stream");
response.end();
@@ -19,7 +20,7 @@ function index(response){
function name(response){
var resData = {};
resData.status = 200;
- resData.contentType = "application/json";
+ response.setHeader("Content-Type", "text/plain");
resData.data = JSON.stringify(postedNames.name[postedNames.name.length-1]);
response.write("hello " + resData.data);
console.log("Name and greeting written to stream");
@@ -30,7 +31,7 @@ function name(response){
function greetPost(response, request){
- var resData = "Thanks for posting your name as" + request.data;
+ var message;
request.on("data", function(data){
var reqData = JSON.parse(data.toString());
@@ -38,18 +39,22 @@ function greetPost(response, request){
postedNames.name.push(reqData.name);
console.log("Name sent from client and posted to postedNames object")
}else{
- reqData = "Not a string";
- resData = "You did not POST a string, try again!";
+ message = "Not a string";
console.log("Client tried to post a non-string");
}
- if(reqData === "Not a string"){
- response.write(resData);
+ if(message === "Not a string"){
console.log("Error written to response for bad POST from Client");
+ response.setHeader("Content-Type", "text/plain");
+ message.status(405);
+ response.write(message);
response.end();
console.log("Client sent error for bad POST from client");
}else{
console.log("Name written to stream");
+ response.setHeader("Content-Type", "text/plain");
+ message = "You have posted your name";
+ response.write(message);
response.end();
console.log("Name sent to client");
}
@@ -67,10 +72,8 @@ function serverTime(response){
var min = time.getMinutes();
var sec = time.getSeconds();
-
-
resData.status = 200;
- resData.contentType = "application/json";
+ response.setHeader("Content-Type", "text/plain");
response.write("The time in hour, minutes, seconds "+ hour + ":" + min + ":" + sec + ". For the miliseconds since 1970, you have " + Date.now());
console.log("Writing server time");
response.end();
diff --git a/dan_lombardy/test/server-test.js b/dan_lombardy/test/server-test.js
index 3eef1b0..4d5c654 100644
--- a/dan_lombardy/test/server-test.js
+++ b/dan_lombardy/test/server-test.js
@@ -5,40 +5,71 @@ var expect = chai.expect;
var chaiHttp = require('chai-http');
chai.use(chaiHttp);
var fs = require('fs');
+var router =require(__dirname + '/../lib/router');
+require(__dirname + '/../index');
-require(__dirname + '/../server');
-
-
+/*before('running', function(){
+ this.indexFileString = fs.readFileSync(__dirname + '/../public/index.html').toString();
+});
+*/
+describe('a server that returns the right routes', function(){
+ before(function() {
+ this.indexFileString = fs.readFileSync(__dirname + '/../public/index.html').toString();
+ });
+ it('a call to "/" should return an html page', function(done){
+ chai.request('localhost:3000')
+ .get('/')
+ .end(function(err, res){
+ expect(res).to.have.status(200);
+ expect(res).to.have.header('content-type');
+ expect(res).to.be.html;
+ expect(res.text).to.eql(this.indexFileString);
+ done();
+ }.bind(this));
+ });
+ it('a call to /greet will return plain text', function(done){
+ chai.request('localhost:3000')
+ .post('/greet')
+ .send({name: "spike"})
+ .end(function(err, res){
+ expect(res).to.have.status(200);
+ expect(res).to.have.header('content-type');
+ expect(res).to.be.text;
+ expect(res.text).to.eql("You have posted your name");
+ done();
+ }.bind(this));
+ });
+ it('a call to /greet/name will return plain text', function(done){
+ chai.request('localhost:3000')
+ .get('/greet/name')
+ .end(function(err, res){
+ expect(res).to.have.status(200);
+ expect(res).to.have.header('content-type');
+ expect(res).to.be.text;
+ expect(res.text.slice(0,5)).to.eql("hello");
+ done();
+ }.bind(this));
+ });
-/*
---take a request of any kind (router)
- --route that requst to the appropriate handler
- ---/timeout GET
- ---/greet/name GET
- --/greet POST
+ it('a call to /server will return plain text', function(done){
+ chai.request('localhost:3000')
+ .get('/server')
+ .end(function(err, res){
+ expect(res).to.have.status(200);
+ expect(res).to.have.header('content-type');
+ expect(res).to.be.text;
+ expect(res.text.slice(0,3)).to.eql("The");
+ done();
+ }.bind(this));
+ });
---do something with a request of any kind (requestHandler)
- route us to each file type that is returned due to the
- request (including the 404)
- --The server should respond to a request to /time that will send back the
- current time of the server.
- --It should also respond to a get request to /greet/name where name is
- any single word string. It should send back a string that greets that name.
- --It should also have a separate post request to /greet that takes the name in JSON format.
---entry point (index) to ignite process
---have an actual server tht runs (server.js).
- server takes in the request and response
-----There should be tests using chaiHTTP for both routes, as well as a gulpfile/package.json
---ou should have an html page that describes the routes implemented by the api available
- at the root of the server (for a bonus point auto populate the routes list, for another bonus point also style the html page)
-*/
-describe('')
+});
diff --git a/jordan_bundy/.gitignore b/jordan_bundy/.gitignore
deleted file mode 100644
index 00e302b..0000000
--- a/jordan_bundy/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.
-..
-.DS_Store
-node_modules
-
diff --git a/jordan_bundy/gulpfile.js b/jordan_bundy/gulpfile.js
deleted file mode 100644
index af1e4ce..0000000
--- a/jordan_bundy/gulpfile.js
+++ /dev/null
@@ -1,44 +0,0 @@
-var gulp = require('gulp');
-var jshint = require('gulp-jshint');
-var mocha = require('gulp-mocha');
-var appFiles = ['index.js', 'lib/**/*.js'];
-var testFiles = ['test/**/*.js'];
-
-gulp.task('jshint:test', function() {
- return gulp.src(testFiles)
- .pipe(jshint({
- node: true,
- globals: {
- describe: true,
- it: true,
- before: true,
- after: true
- }
- }))
- .pipe(jshint.reporter('default'));
-});
-
-gulp.task('jshint:app', function() {
- return gulp.src(appFiles)
- .pipe(jshint({
- node: true
- }))
- .pipe(jshint.reporter('default'));
-});
-
-gulp.task('mocha:test', function() {
- return gulp.src(testFiles)
- .pipe(mocha({
- read: false,
- reporter: 'nyan'
- }))
-});
-
-gulp.task('watch', function() {
- gulp.watch(['./**/*', '!./package.json'], ['jshint', 'mocha']);
-});
-
-gulp.task('jshint', ['jshint:test', 'jshint:app']);
-gulp.task('mocha', ['mocha:test']);
-gulp.task('default', ['jshint', 'mocha', 'watch']);
-
diff --git a/jordan_bundy/lib/routes.js b/jordan_bundy/lib/routes.js
deleted file mode 100644
index 889242c..0000000
--- a/jordan_bundy/lib/routes.js
+++ /dev/null
@@ -1,49 +0,0 @@
-var fs = require('fs');
-
-var routes = {};
-var routeList = '';
-
-routes['/'] = {
- GET: {
- status: 200,
- contentType: 'text/html',
- data: fs.readFileSync(__dirname + '/../public/index.html').toString()
- }
-};
-
-routes['/name'] = {
- GET: {
- status: 200,
- contentType: 'text/plain',
- data: 'Hello there Mr. '
- },
- POST: {
-
- }
-};
-
-routes['/time'] = {
- GET: {
- status: 200,
- contentType: 'text/plain',
- data: new Date().toString()
- }
-};
-
-Object.keys(routes).forEach(function(route) {
- routeList += '' + route + ' ';
-});
-
-fs.writeFileSync(__dirname + '/../public/index.html', ''+
- ''+
- ''+
- ''+
- ''+
- '
- Do a post request with a JSON object to http://localhost:3000/greet/ using superagent (Example: superagent localhost:3000/greet post '{"name": "Cornelius"}'), and you will get a JSON string back!
-