-
Notifications
You must be signed in to change notification settings - Fork 192
[Assignment #1]: Basic HTTP Server #3
Changes from 5 commits
d5a5acf
bcb0ee1
9dfc023
a31611d
574d6e3
0dbf4a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.idea | ||
*.iml | ||
npm-debug.log | ||
dump.rdb | ||
node_modules | ||
results.tap | ||
results.xml | ||
config.json | ||
.DS_Store | ||
*/.DS_Store | ||
*/*/.DS_Store | ||
._* | ||
*/._* | ||
*/*/._* | ||
coverage.* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var Hapi = require('hapi'); | ||
var internals = { | ||
version: require('./package.json').version | ||
}; | ||
|
||
var server = new Hapi.Server(); | ||
|
||
server.connection({ port: 8000 }); | ||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/version', | ||
config: { | ||
handler: function (request, reply) { | ||
|
||
return reply({ version: internals.version }); | ||
} | ||
} | ||
}); | ||
|
||
server.start(function (err) { | ||
if (err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
throw err; | ||
} | ||
else { | ||
console.log('Server running at:', server.info.uri); | ||
} | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super bike sheddy, but I'm a stickler for white space. You might want to add an extra line here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I will do it.. but may I suggest we might use EditorConfig to unify the coding style ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/editorconfig/editorconfig/wiki/Newline-at-End-of-File-Support Fairly supported and a good idea Here is an example one we can iterate from if you like --> https://github.com/Famous/famous/blob/develop/.editorconfig There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Standard linting rules for Hapi can be found in Lab https://github.com/hapijs/lab/tree/master/lib/linters There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eslint / jscs doesn't create the functionality that an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. true but it does add some 'restrictions' There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guys, Do I need to do anything more here or it's now fine ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assignment is due 17/3 and your PR will be closed either by being merged or probably be closed by @hueniverse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah cool thanks a lot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a new line at the end of files |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "hueniversity", | ||
"version": "0.0.1", | ||
"description": "Assignment One", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hueniverse/hueniversity.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/hueniverse/hueniversity/issues" | ||
}, | ||
"homepage": "https://github.com/hueniverse/hueniversity", | ||
"dependencies": { | ||
"hapi": "^8.3.1" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would read better if this line moved down before
server.connection()
.