Skip to content

Commit

Permalink
[RELEASE] v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdizriel authored Jul 20, 2016
2 parents f9ff5b2 + d2a7cb8 commit 3fa89d9
Show file tree
Hide file tree
Showing 38 changed files with 1,237 additions and 783 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
.idea
node_modules
dist
coverage
29 changes: 0 additions & 29 deletions .jshintrc

This file was deleted.

6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ env:
- MONGODB_URI=mongodb://localhost/service

before_script:
- npm install
- "cd server"
- "npm install"
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

script:
- npm run coveralls

after_success:
- bash <(curl -s https://codecov.io/bash)

services: mongodb
2 changes: 1 addition & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ For issue: https://github.com/Abdizriel/nodejs-microservice-starter/issues/<issu
- [ ] I have read the [Contributing Documents](https://github.com/Abdizriel/nodejs-microservice-starter/blob/master/CONTRIBUTING.md)
- [ ] My commit(s) follow the [commit message guidelines](https://github.com/Abdizriel/nodejs-microservice-starter/blob/master/CONTRIBUTING.md#commit-message-format)
- [ ] Project tests pass (`npm test`)
- [ ] Project tests coverage is **100%**
- [ ] Project tests coverage is at least **90%**
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![NodeJS RESTful API Microservice Logo](https://github.com/Abdizriel/nodejs-microservice-starter/blob/master/logo.jpg)

# NodeJS RESTful API Microservice Starter v1.1.0
# NodeJS RESTful API Microservice Starter v1.2.0
This repository contains a full configuration that runs NodeJS RESTful API Microservice Starter.

[![Build Status](https://secure.travis-ci.org/Abdizriel/nodejs-microservice-starter.png?branch=master)](https://travis-ci.org/Abdizriel/nodejs-microservice-starter)
Expand Down Expand Up @@ -77,21 +77,3 @@ docker-compose up -d --build
```

See `Dockerfile` and `docker-compose.yml` for more details.

## Deployment

### Heroku

* Build Microservice by using following command `npm run build`
* Go to builded directory *dist*
* Download and install [Heroku Toolbelt](https://toolbelt.heroku.com/ "Heroku Toolbelt")
* Log in to Heroku by using following command `heroku login`
* Run following command `heroku create`
* Run following command `heroku addons:create mongolab` to add MongoDB to your application.
* Run following command `git push heroku master` to push your application to Heroku.

## TODO

* [#2](https://github.com/Abdizriel/nodejs-microservice-starter/issues/2) API Authentication oAuth2
* [#3](https://github.com/Abdizriel/nodejs-microservice-starter/issues/3) Waterline ORM
* [#5](https://github.com/Abdizriel/nodejs-microservice-starter/issues/5) 100% Test Coverage
12 changes: 9 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,38 @@ nginx:

# NodeJS RESTful API Microservice
microservice1:
build: ./dist
build: ./server/dist
links:
- mongo:mongo
ports:
- "9001:9000"
environment:
NODE_ENV: production
MONGODB_URI: mongodb://mongo/service
IP: 0.0.0.0
PORT: 9000
microservice2:
build: ./dist
build: ./server/dist
links:
- mongo:mongo
ports:
- "9002:9000"
environment:
NODE_ENV: production
MONGODB_URI: mongodb://mongo/service
IP: 0.0.0.0
PORT: 9000
microservice3:
build: ./dist
build: ./server/dist
links:
- mongo:mongo
ports:
- "9003:9000"
environment:
NODE_ENV: production
MONGODB_URI: mongodb://mongo/service
IP: 0.0.0.0
PORT: 9000

# MongoDB
mongo:
Expand Down
42 changes: 0 additions & 42 deletions package.json

This file was deleted.

4 changes: 4 additions & 0 deletions server/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015", "stage-0"],
"plugins": ["transform-class-properties"]
}
File renamed without changes.
4 changes: 4 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PORT=
IP=
NODE_ENV=
MONGODB_URI=
5 changes: 5 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea
node_modules
dist
coverage
server/config/.env
15 changes: 15 additions & 0 deletions server/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"expr": true,
"node": true,
"esnext": true,
"bitwise": true,
"eqeqeq": true,
"immed": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"undef": true,
"smarttabs": true,
"asi": true,
"debug": true
}
14 changes: 14 additions & 0 deletions server/.jshintrc-spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": ".jshintrc",
"globals": {
"describe": true,
"it": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true,
"expect": true,
"assert": true,
"sinon": true
}
}
File renamed without changes.
File renamed without changes.
47 changes: 21 additions & 26 deletions server/api/service/index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
'use strict';

/**
* @description Service route Controller
* @param ServiceController
* @description Express Framework Router
* @param Router
*/
import ServiceController from './service.controller';
import { Router } from 'express';

/**
* @class ServiceRoutes
* @classdesc Class that represents Service routes
* @exports ServiceRoutes
* @default
* @description Service route Controller
* @param ServiceController
*/
export default class ServiceRoutes {
import * as ServiceController from './service.controller';

/**
* @function init
* @description Init Service routes for Express router
* @param {Router} router - Express Framework Router
* @static
*/
static init(router) {
let router = new Router();

// /api/services routes configs
router.route('/services')
.get(ServiceController.list)
.post(ServiceController.create);
router.get('/', ServiceController.index);
router.get('/:id', ServiceController.show);
router.post('/', ServiceController.create);
router.put('/:id', ServiceController.update);
router.patch('/:id', ServiceController.update);
router.delete('/:id', ServiceController.destroy);

// /api/services/:id routes configs
router.route('/services/:id')
.get(ServiceController.show)
.put(ServiceController.update)
.delete(ServiceController.delete);
}
}
/**
* @description Configured router for Service Routes
* @exports router
* @default
*/
export default router;
Loading

0 comments on commit 3fa89d9

Please sign in to comment.