This repository was archived by the owner on Apr 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 192
[Assignment 1] Basic server #7
Merged
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4d71fc5
Basic server
AdriVanHoudt adf6eba
Add new line to end gitignore
AdriVanHoudt a70b834
tabs to spaces
AdriVanHoudt f6586d8
[DEP] Hapi 8.3.x to Hapi 8.4.x
AdriVanHoudt d771494
feedback patch // moved logic to lib index file // added hoek for err
AdriVanHoudt 8ac5e6f
Moved handler to config
AdriVanHoudt 95133ad
styling stuff
AdriVanHoudt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.idea | ||
*.iml | ||
npm-debug.log | ||
node_modules | ||
.DS_Store | ||
*/.DS_Store | ||
*/*/.DS_Store | ||
._* | ||
*/._* | ||
*/*/._* | ||
coverage.* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var Hapi = require('hapi'); | ||
|
||
var internals = { | ||
pkg: require('./package.json') | ||
}; | ||
|
||
var server = new Hapi.Server(); | ||
|
||
server.connection({ port: process.env.PORT || 8000 }); | ||
|
||
server.route({ | ||
method: 'GET', | ||
path: '/version', | ||
handler: function (request, reply) { | ||
|
||
return reply({ version: internals.pkg.version }); | ||
}, | ||
config: { | ||
description: 'Returns the version of the server' | ||
} | ||
}); | ||
|
||
server.start(function (err) { | ||
|
||
if (err) { | ||
throw err | ||
} | ||
|
||
// once we have something like good-console we can use server.log here | ||
console.log('Server started at: ' + server.info.uri); | ||
}); |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "hueniversity", | ||
"version": "0.0.1", | ||
"description": "Community learning experiment", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"start": "node index.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/hueniverse/hueniversity.git" | ||
}, | ||
"keywords": [ | ||
"hapi", | ||
"hapijs", | ||
"hapi.js" | ||
], | ||
"author": "Hueniversity students", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/hueniverse/hueniversity/issues" | ||
}, | ||
"homepage": "https://github.com/hueniverse/hueniversity", | ||
"dependencies": { | ||
"hapi": "8.3.x" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
according to the overview submissions should be using the hapi style guide, which specifies 4 spaces for rather than tabs for indents
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.
Thanks for the head up, I'll have to change IDE settings for that, no problem
And I didn't know that guide existed O_o
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.
no probs 😄