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

[Assignment 1] - Basic Server #39

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 15 additions & 0 deletions .gitignore
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.*
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./lib/index.js');
Copy link
Contributor

Choose a reason for hiding this comment

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

new line at end of file ;)

31 changes: 31 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var Hapi = require('hapi');
var Hoek = require('hoek');
var Package = require('../package.json');

var internals = {};

internals.server = new Hapi.Server();

internals.server.connection({ port: 8000 });

internals.response = {
version: Package.version
};

internals.server.route({
path: '/version',
method: 'GET',
config: {
description: 'Get server version',
handler: function (request, reply) {

return reply(internals.response);
}
}
});

internals.server.start(function (err) {

Hoek.assert(!err, err);
console.log('info', 'Server started at: ' + internals.server.info.uri);
});
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"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"
},
"author": "",
"license": "BSD",
"bugs": {
"url": "https://github.com/hueniverse/hueniversity/issues"
},
"homepage": "https://github.com/hueniverse/hueniversity",
"dependencies": {
"hapi": "^8.4.0",
"hoek": "^2.11.1"
}
}