Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

[Assignment 1] Basic server #7

Merged
merged 7 commits into from
Mar 17, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
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.*
31 changes: 31 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var Hapi = require('hapi');

var internals = {
pkg: require('./package.json')
Copy link

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

Copy link
Contributor Author

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no probs 😄

};

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 added lib/index.js
Empty file.
28 changes: 28 additions & 0 deletions package.json
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"
}
}