Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Commit

Permalink
Basic http server - Assigment 1
Browse files Browse the repository at this point in the history
  • Loading branch information
rutaihwa committed Mar 13, 2015
1 parent 15d02cd commit 7d20e56
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
46 changes: 46 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use strict';

// Index for basic http server

// Dependencies

var Hapi = require('hapi');


// Internal links
var internals = {
pkg: require('./package.json')
}

// Create a server
var server = new Hapi.Server();


// Creates a connection

server.connection({ port: process.env.PORT || 8000 });

// Routes


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

// Return the version of the application

return reply({ verison: internals.pkg.version });
}
});


server.start(function(err){
if (err){

throw err;
}

// Log the running server
console.log('Server is running at ' + server.info.uri);
});
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "hueniviersity",
"version": "0.0.1",
"description": "Communitiy learning experiment",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/hueniverse/hueniversity.git"
},
"keywords": [
"hapi",
"hapijs"
],
"author": "Community",
"bugs": {
"url": "https://github.com/hueniverse/hueniversity/issues"
},
"homepage": "https://github.com/hueniverse/hueniversity",
"dependencies": {
"hapi": "^8.3.1"
}
}

0 comments on commit 7d20e56

Please sign in to comment.