Skip to content

Commit

Permalink
Merge pull request #35 from molekilla/rel0.6.2
Browse files Browse the repository at this point in the history
Rel0.6.2
  • Loading branch information
molekilla committed Jan 15, 2015
2 parents 435c8d1 + 9a22fb5 commit ef93e49
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 19 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ Pure pragmatic NodeJS stack

For updates, read [changelog](changelog.md)

### Last update: 0.6.1
### Last update: 0.6.2

### Features ###

After years of dealing with Sinatra (Ruby) and Backbone, and a brief ExpressJS side project, I figure out that:

* **AngularJS 1.3.2**
* **Hapi 8.0.0**
* **Jasmine 2.0**: Both Angular Protractor and Facebook Jest are based on Jasmine. Using Mocha/Chai combo just adds to your learning curve. Jasmine 2.0 has been given more updates than ever before. Is a must have.
Expand All @@ -36,6 +34,8 @@ After years of dealing with Sinatra (Ruby) and Backbone, and a brief ExpressJS s
* [Istanbul code coverage support](http://gotwarlost.github.io/istanbul/)
* Uses canned responses / server mocks / nobackend inspired by Euge's [canned responses](https://github.com/euge/canned-responses)
* [Angular Hint](https://github.com/angular/angular-hint)
* [Hapi Swagger](https://github.com/glennjones/hapi-swagger)
* [Grunt JSDoc3](https://github.com/krampstudio/grunt-jsdoc)

### Installing ###
1. Clone repo
Expand All @@ -58,6 +58,7 @@ After years of dealing with Sinatra (Ruby) and Backbone, and a brief ExpressJS s
* `grunt migrate:create [--name]`: Creates a migration task. Args: --name: migration name (optional)
* `grunt migrate:up [--revision]`: Migrates up. Args: --revision: revision name (optional)
* `grunt migrate:down [--revision]`: Migrates down. Args: --revision: revision name (optional)
* `grunt docs`: Builds jsdoc3 documentation.

### Grunt Help (Frontend) ###

Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ Pure pragmatic NodeJS stack

### Changelog ###

#### 0.6.2

* Adding `grunt-jsdoc` in service (with `rutha-grunt-tasks-service`). Closes issue #21.
* Adding `hapi-swagger` in service. Closes issue #12.

#### 0.6.1

* Adding missing `bcrypt-nodejs` dependency in service
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rutha_stack",
"version": "0.6.1",
"version": "0.6.2",
"main": "ui/lib/hapi/server.js",
"description": "Rutha Dev Stack",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions service/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
node_modules/
logs/
test/
docs/

# Files
# test.pdf
Expand Down
28 changes: 28 additions & 0 deletions service/jsdoc.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"tags" : {
"allowUnknownTags" : true
},
"plugins" : ["plugins/markdown"],

"templates" : {
"cleverLinks" : false,
"monospaceLinks" : false,
"dateFormat" : "ddd MMM Do YYYY",
"outputSourceFiles" : true,
"outputSourcePath" : true,
"systemName" : "Rutha",
"footer" : "",
"copyright" : "Rutha © 2015",
"navType" : "vertical",
"theme" : "cosmo",
"linenums" : true,
"collapseSymbols" : false,
"inverseNav" : true,
"highlightTutorialCode" : true,
"protocol": "fred://"
},
"markdown" : {
"parser" : "gfm",
"hardwrap" : true
}
}
7 changes: 5 additions & 2 deletions service/lib/controllers/users/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
var debug = require('debug')('users');
var createHandler = require('./v1/create.js');
var users = require('./v1');

exports.register = function(plugin, options, next) {

plugin.route({
method: 'POST',
path: '/v1/users',
handler: createHandler,
handler: users.create,
config: {
description: 'A new account',
notes: 'Creates a new account',
tags: ['api'],
auth: 'token'
}
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@

var debug = require('debug')('users:list');
/** @module users */

module.exports = function(request, reply) {
/**
* Creates a new user
* @function
* @param {Object} request - A Hapi Request
* @param {Object} reply - A Hapi Reply
*/
exports.create = function(request, reply) {
var server = request.server;
var UserModel = server.app.mongoose.models.User;

Expand Down
36 changes: 28 additions & 8 deletions service/lib/hapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,43 @@ server.app = {
logger: logger
};


// add server methods to IoC mongoose models
var controllers = [
{
register: require('lout'),
register: require('../controllers/users'),
}
];

var serverPlugins = [
{
register: require('hapi-auth-bearer-token')
},
{
register: require('hapi-swagger'),
options:
{
endpoint: '/api/docs'
basePath: 'http://localhost:' + config.get('apiServer:port'),
apiVersion: '1.0',
documentationPath: '/api_docs',
endpoint: '/rest_docs',
authorizations: {
token: {
type: "apiKey",
passAs: "header",
keyname: "authentication"
}
},
info: {
title: 'Rutha REST API Documentation',
description: 'REST API Docs.',
contact: '[email protected]',
license: 'MIT'
}
}
},
{
register: require('../controllers/users'),
}
];


server.register(require('hapi-auth-bearer-token'), function(err) {
server.register(serverPlugins, function(err) {

server.auth.strategy('token', 'bearer-access-token', {
validateFunc: function(token, callback) {
Expand Down
8 changes: 5 additions & 3 deletions service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rutha_stack_service",
"version": "0.6.1",
"version": "0.6.2",
"description": "Rutha REST API Service",
"main": "lib/hapi/index.js",
"scripts": {
Expand All @@ -23,6 +23,7 @@
"grunt-env": "~0.4.1",
"grunt-istanbul": "~0.3.0",
"grunt-jasmine-node": "~0.2.1",
"grunt-jsdoc": "^0.6.2",
"grunt-node-inspector": "~0.1.5",
"grunt-nodemon": "~0.2.1",
"grunt-nsp-package": "0.0.5",
Expand All @@ -31,7 +32,7 @@
"load-grunt-config": "~0.13.1",
"mongodb": "^1.4.18",
"rutha-grunt-mongo-migrations": "^0.1.1",
"rutha-grunt-tasks-service": "~0.1.4",
"rutha-grunt-tasks-service": "~0.1.5",
"time-grunt": "~0.4.0"
},
"dependencies": {
Expand All @@ -40,9 +41,10 @@
"debug": "~2.1.0",
"hapi": "~8.0.0",
"hapi-auth-bearer-token": "^3.1.0",
"hapi-swagger": "^0.6.1",
"joi": "^5.0.2",
"mongoose": "^3.8.21",
"lout": "^6.0.1",
"mongoose": "^3.8.21",
"rutha-utils": "^1.0.0",
"underscore": "~1.7.0"
}
Expand Down
1 change: 1 addition & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
node_modules/
logs/
dist/
docs/

# Files
# test.pdf
Expand Down
4 changes: 3 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rutha_stack_frontend",
"version": "0.6.1",
"version": "0.6.2",
"description": "Rutha Front End",
"main": "lib/hapi/index.js",
"scripts": {
Expand Down Expand Up @@ -28,8 +28,10 @@
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-jasmine-node": "~0.2.1",
"grunt-jsdoc": "^0.6.2",
"grunt-karma": "^0.9.0",
"grunt-ng-annotate": "~0.4.0",
"grunt-ngdocs": "^0.2.6",
"grunt-node-inspector": "~0.1.5",
"grunt-nodemon": "~0.2.1",
"grunt-nsp-package": "0.0.5",
Expand Down

0 comments on commit ef93e49

Please sign in to comment.