-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
5,892 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"env": { | ||
"commonjs": true, | ||
"mocha": true, | ||
"node": true, | ||
"es6": true | ||
}, | ||
"ecmaFeatures": { | ||
"arrowFunctions": true, | ||
"blockBindings": true, | ||
"classes": true, | ||
"defaultParameters": true, | ||
"destructuring": true, | ||
"forOf": true, | ||
"generators": true, | ||
"modules": true, | ||
"objectLiteralComputedProperties": true, | ||
"objectLiteralDuplicateProperties": true, | ||
"objectLiteralShorthandMethods": true, | ||
"objectLiteralShorthandProperties": true, | ||
"regexUFlag": true, | ||
"regexYFlag": true, | ||
"restParams": true, | ||
"spread": true, | ||
"superInFunctions": true, | ||
"templateStrings": true, | ||
"unicodeCodePointEscapes": true, | ||
"globalReturn": true | ||
}, | ||
"globals": { | ||
"_": false, | ||
"angular": false, | ||
"mocks": false, | ||
"console": false, | ||
"inject": true, | ||
"module": true, | ||
"window": false, | ||
"expect": true, | ||
"require": true, | ||
"onPrepare": true, | ||
"onComplete": true, | ||
"browser": true, | ||
"jasmine": true, | ||
"sinon": true, | ||
"beforeEach": true, | ||
"afterEach": true, | ||
"schema": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.idea/ | ||
.vscode/ | ||
node_modules/ | ||
public/jspm_packages/ | ||
public/node_modules/ | ||
public/bower/ | ||
config/local-production.yaml | ||
config/local-development.yaml | ||
config/local-test.yaml | ||
logs/* | ||
!logs/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--require test/helpers | ||
--recursive test/**/*.spec.js | ||
--timeout 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict' | ||
|
||
if (!process.env.NODE_ENV) process.env.NODE_ENV = 'production' | ||
|
||
const express = require('express') | ||
const app = express() | ||
const config = require('config') | ||
const morgan = require('morgan') | ||
const methodOverride = require('method-override') | ||
const bodyParser = require('body-parser') | ||
|
||
module.exports = { app } | ||
|
||
const { headersMiddleware } = require('./src/middlewares') | ||
const { corsService, logDebugService, logService } = require('./src/services') | ||
const responses = require('./src/services/helpers/responses') | ||
const { logger } = logService | ||
|
||
const routes = require('./src/routes') | ||
|
||
const port = config.get('app.port') | ||
const host = config.get('app.host') | ||
|
||
app.use(corsService.corsBase()) | ||
app.use(headersMiddleware) | ||
app.use(bodyParser.json()) | ||
app.use(bodyParser.urlencoded({ extended: true })) | ||
app.use(methodOverride()) | ||
|
||
if ( | ||
config.has('logDebug.enableServerStream') && | ||
config.get('logDebug.enableServerStream') | ||
) { | ||
app.use( | ||
morgan('combined', { | ||
stream: { write: msg => logDebugService.debug(msg) } | ||
}) | ||
) | ||
} | ||
|
||
app.use('/', routes) | ||
|
||
app.use((req, res, next) => { | ||
responses.failure(404, 'Not found', res) | ||
}) | ||
|
||
app.use((err, req, res, next) => { | ||
logger.error('Found %s at %s', 'error', err) | ||
|
||
responses.failure( | ||
err.statusCode ? err.statusCode : 500, | ||
err.message || err.statusMessage || '', | ||
res | ||
) | ||
}) | ||
|
||
const server = app.listen(port, host, function() { | ||
const host = server.address().address | ||
const port = server.address().port | ||
|
||
logger.info(`Server listening on host ${host} port ${port}`) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
app: | ||
port: 31339 | ||
host: 127.0.0.1 | ||
cors: | ||
enable: true | ||
whitelist: null # array | ||
|
||
logDebug: | ||
prefix: '' | ||
postfix: :app | ||
enableInfo: true | ||
enableDev: true | ||
enableError: true | ||
enableServerStream: true | ||
|
||
log: | ||
label: :app | ||
pathError: logs/error.log | ||
pathExcLogger: logs/exceptions-logger.log | ||
pathLog: logs/log.log | ||
enableConsole: true | ||
enableColor: true | ||
enableColorPathError: false | ||
enableColorPathExcLogger: false | ||
enableColorPathLog: false | ||
maxSize: null | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
app: | ||
port: 31339 | ||
host: 127.0.0.1 | ||
|
||
logDebug: | ||
postfix: :app-dev | ||
enableInfo: true | ||
enableDev: true | ||
enableError: true | ||
enableServerStream: true | ||
|
||
log: | ||
label: :app-dev | ||
pathExcLogger: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
app: | ||
port: 31339 | ||
cors: | ||
enable: true | ||
whitelist: null # array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
app: | ||
port: 31339 | ||
cors: | ||
enable: true | ||
whitelist: null # array | ||
|
||
log: | ||
label: :app-prod | ||
pathError: logs/error.log | ||
pathExcLogger: 'logs/exceptions-logger.log' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
app: | ||
port: 3001 | ||
|
||
logDebug: | ||
postfix: :app-test | ||
enableInfo: false | ||
enableDev: false | ||
enableError: false | ||
enableServerStream: false | ||
|
||
log: | ||
label: :app-test | ||
enableConsole: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
app: | ||
port: 31339 | ||
host: 127.0.0.1 | ||
|
||
logDebug: | ||
postfix: :app-prod | ||
enableInfo: false | ||
enableDev: false | ||
enableError: false | ||
enableServerStream: false | ||
|
||
log: | ||
label: :app-prod | ||
enableConsole: false | ||
pathError: null | ||
pathLog: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
app: | ||
port: 3001 | ||
host: 127.0.0.1 | ||
|
||
logDebug: | ||
postfix: :app-test | ||
enableInfo: false | ||
enableDev: false | ||
enableError: false | ||
enableServerStream: false | ||
|
||
log: | ||
label: :app-test | ||
enableConsole: false |
Empty file.
Oops, something went wrong.