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

[Assignment 1] Create a basic HTTP server #5

Closed
wants to merge 1 commit into from

Conversation

MylesBorins
Copy link
Contributor

This is a first pass at implementing a basic HTTP server that has a single route /version that returns the version from package.json

This PR does not include and automated lintint / testing, but it could easily be added.

@MylesBorins MylesBorins force-pushed the lesson-1 branch 4 times, most recently from be2c35d to 45ff9ff Compare March 16, 2015 06:33
@MylesBorins MylesBorins changed the title [Lesson 1] Create a basic HTTP server [Assignment 1] Create a basic HTTP server Mar 16, 2015
@MylesBorins
Copy link
Contributor Author

Closes #1

@@ -0,0 +1,26 @@
'use strict';

Choose a reason for hiding this comment

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

In general, I don't find 'use strict' useful. I don't have an objection to it, but we don't include it in hapi modules.

@MylesBorins
Copy link
Contributor Author

@hueniverse All notes fixed

@hueniverse hueniverse modified the milestone: 0.0.1 Mar 16, 2015
path: '/version',
handler: function (request, reply) {

return reply(internals);

Choose a reason for hiding this comment

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

This is dangerous. internals is expected to grow as the project evolves. By passing it directly here you are basically using a hack. This will cause surprises later when you expose config and other static info that has nothing to do with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to response with internals.response. I think this might suffer from a similar problem, as there might be multiple responses. I will be looking through other examples on how to improve this.

This is a first pass at implementing a basic HTTP server that has a single route ```/version``` that returns the version from ```package.json```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants