├── src
├── schema
│ └── schema.ts
├── app
│ ├── utils
│ │ ├── main.utils.ts
│ │ ├── error.utils.ts
│ │ ├── api.utils.ts
│ │ ├── tracing.utils.ts
│ │ └── auth.utils.ts
│ ├── db
│ │ └── schema
│ │ │ └── dbschema.ts
│ ├── public
│ │ ├── favicon.ico
│ │ └── index.html
│ ├── views
│ │ ├── error
│ │ │ └── 404.server.view.html
│ │ └── index.server.view.html
│ ├── controllers
│ │ ├── api.server.controller.ts
│ │ ├── metrics.server.controller.ts
│ │ └── auth.server.controller.ts
│ └── routes
│ │ ├── root.server.routes.ts
│ │ └── api.server.routes.ts
├── types
│ └── interfaces.d.ts
├── config
│ ├── strategies
│ │ └── local.js
│ ├── config.ts
│ └── express.ts
├── tests
│ └── test.ts
└── server.ts
├── dist
├── config
│ ├── strategies
│ │ └── local.js
│ ├── env
│ │ ├── all.js
│ │ ├── all.js.map
│ │ ├── alpha.js.map
│ │ ├── secure.js.map
│ │ ├── production.js.map
│ │ ├── development.js.map
│ │ ├── alpha.js
│ │ ├── secure.js
│ │ ├── development.js
│ │ └── production.js
│ ├── logger.js
│ ├── logger.js.map
│ ├── init.js.map
│ ├── config.js.map
│ ├── init.js
│ ├── config.js
│ ├── express.js.map
│ └── express.js
├── schema
│ ├── schema.js
│ └── schema.js.map
├── app
│ ├── db
│ │ └── schema
│ │ │ ├── dbschema.js
│ │ │ └── dbschema.js.map
│ ├── utils
│ │ ├── main.utils.js
│ │ ├── main.utils.js.map
│ │ ├── api.utils.js.map
│ │ ├── auth.utils.js.map
│ │ ├── error.utils.js
│ │ ├── error.utils.js.map
│ │ ├── auth.utils.js
│ │ ├── tracing.utils.js.map
│ │ ├── tracing.utils.js
│ │ └── api.utils.js
│ ├── public
│ │ ├── favicon.ico
│ │ └── index.html
│ ├── views
│ │ ├── index.server.view.html
│ │ └── error
│ │ │ └── 404.server.view.html
│ ├── controllers
│ │ ├── api.server.controller.js
│ │ ├── api.server.controller.js.map
│ │ ├── metrics.server.controller.js
│ │ ├── metrics.server.controller.js.map
│ │ ├── auth.server.controller.js.map
│ │ └── auth.server.controller.js
│ └── routes
│ │ ├── root.server.routes.js.map
│ │ ├── root.server.routes.js
│ │ ├── api.server.routes.js.map
│ │ └── api.server.routes.js
├── tests
│ ├── test.js.map
│ └── test.js
├── server.js
└── server.js.map
├── .dockerignore
├── logs
└── README.md
├── .gitignore
├── .prettierignore
├── .eslintignore
├── docs
├── assets
│ └── images
│ │ ├── icons.png
│ │ ├── icons@2x.png
│ │ ├── widgets.png
│ │ └── widgets@2x.png
└── modules
│ ├── _schema_schema_.html
│ ├── _config_env_all_.html
│ ├── _config_env_alpha_.html
│ ├── _config_env_secure_.html
│ ├── _app_utils_main_utils_.html
│ ├── _config_env_production_.html
│ ├── _app_db_schema_dbschema_.html
│ ├── _config_env_development_.html
│ ├── _app_routes_api_server_routes_.html
│ └── _app_routes_root_server_routes_.html
├── .prettierrc
├── Makefile
├── CONTRIBUTORS.txt
├── creds
├── jwtRS512.key.pub
└── jwtRS512.key
├── .env
├── .travis.yml
├── kubernetes
├── service.yml
└── deployment.yml
├── CHANGELOG.md
├── nodemon.json
├── CONTRIBUTING.md
├── Dockerfile
├── .vscode
├── settings.json
├── tasks.json
└── launch.json
├── docker-compose-prod.yml
├── tsconfig.json
├── .editorconfig
├── typedoc.js
├── docker-compose.yml
├── pm2-dev.json
├── Dockerfile-prod
├── LICENSE
├── package.json
├── CODE_OF_CONDUCT.md
└── README.md
/src/schema/schema.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/utils/main.utils.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/types/interfaces.d.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/dist/config/strategies/local.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/app/db/schema/dbschema.ts:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/config/strategies/local.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | dist
2 | node_modules
3 | npm-debug.log
--------------------------------------------------------------------------------
/dist/schema/schema.js:
--------------------------------------------------------------------------------
1 | //# sourceMappingURL=schema.js.map
--------------------------------------------------------------------------------
/logs/README.md:
--------------------------------------------------------------------------------
1 | ## Directory to store application logs
2 |
--------------------------------------------------------------------------------
/dist/app/db/schema/dbschema.js:
--------------------------------------------------------------------------------
1 | //# sourceMappingURL=dbschema.js.map
--------------------------------------------------------------------------------
/dist/app/utils/main.utils.js:
--------------------------------------------------------------------------------
1 | //# sourceMappingURL=main.utils.js.map
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | logs/*.log
3 | pm2-prod.json
4 | pm2-alpha.json
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | dist/
2 | node_modules/
3 | docs/
4 | logs/
5 | .vscode/
6 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | **/*.yml
2 | **/*.json
3 | **/*.md
4 | **/Dockerfile
5 | docs/**/*.*
--------------------------------------------------------------------------------
/dist/app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/dist/app/public/favicon.ico
--------------------------------------------------------------------------------
/src/app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/src/app/public/favicon.ico
--------------------------------------------------------------------------------
/docs/assets/images/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/docs/assets/images/icons.png
--------------------------------------------------------------------------------
/docs/assets/images/icons@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/docs/assets/images/icons@2x.png
--------------------------------------------------------------------------------
/docs/assets/images/widgets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/docs/assets/images/widgets.png
--------------------------------------------------------------------------------
/dist/app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
Hello World
3 |
4 |
5 | Hello World
6 |
7 |
8 |
--------------------------------------------------------------------------------
/docs/assets/images/widgets@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tvvignesh/node-skeleton/HEAD/docs/assets/images/widgets@2x.png
--------------------------------------------------------------------------------
/src/app/public/index.html:
--------------------------------------------------------------------------------
1 |
2 | Hello World
3 |
4 |
5 | Hello World
6 |
7 |
8 |
--------------------------------------------------------------------------------
/dist/schema/schema.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/dist/app/utils/main.utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"main.utils.js","sourceRoot":"","sources":["../../../src/app/utils/main.utils.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/dist/app/db/schema/dbschema.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"dbschema.js","sourceRoot":"","sources":["../../../../src/app/db/schema/dbschema.ts"],"names":[],"mappings":""}
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 80,
3 | "singleQuote": true,
4 | "trailingComma": "none",
5 | "useTabs": false,
6 | "semi": true,
7 | "tabWidth": 4
8 | }
9 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | build:
2 | docker-compose build
3 |
4 | start:
5 | docker-compose up
6 |
7 | stop:
8 | docker-compose stop
9 |
10 | kill: stop
11 | docker-compose rm
--------------------------------------------------------------------------------
/CONTRIBUTORS.txt:
--------------------------------------------------------------------------------
1 | This file contains a list of people who have made large contributions to the open source project.
2 |
3 | Original design and implementation:
4 | Vignesh T.V.
5 |
--------------------------------------------------------------------------------
/creds/jwtRS512.key.pub:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANZR6QCmHaXu9PjukLm8m4y0YD3DDsLj
3 | XznG4WggyMTblClQOy4HQcenL/JtSXDKQmWCZHrtMmEiBFouoTecffUCAwEAAQ==
4 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | NODEJS_PORT=8085
2 | DEBUG=9229
3 | SEVER_PORT=8085:8085
4 | DEBUG_PORT=9229:9229
5 | NODE_ENV=production
6 | MONGO_HOST=app-db:27017
7 | NODEJS_IP=0.0.0.0
8 | JWT_ISSUER=node-skeleton
9 | TOGGLE_APIDOC=TRUE
10 |
--------------------------------------------------------------------------------
/src/tests/test.ts:
--------------------------------------------------------------------------------
1 | import test from 'ava';
2 |
3 | test('foo', (t) => {
4 | t.pass();
5 | });
6 |
7 | test('bar', async (t) => {
8 | const bar = Promise.resolve('bar');
9 |
10 | t.is(await bar, 'bar');
11 | });
12 |
--------------------------------------------------------------------------------
/dist/app/views/index.server.view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{head.title}}
7 |
8 |
9 |
10 | {{content.title}}
11 | {{content.description}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/app/views/error/404.server.view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{head.title}}
7 |
8 |
9 |
10 | {{content.title}}
11 | {{content.description}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/app/views/index.server.view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{head.title}}
7 |
8 |
9 |
10 | {{content.title}}
11 | {{content.description}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/dist/app/views/error/404.server.view.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | {{head.title}}
7 |
8 |
9 |
10 | {{content.title}}
11 | {{content.description}}
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: required
3 | services:
4 | - docker
5 | node_js:
6 | - "12.9.0"
7 | jobs:
8 | include:
9 | - stage: unit
10 | script:
11 | - npm install
12 | - npm run build
13 | - npm run test
14 |
--------------------------------------------------------------------------------
/kubernetes/service.yml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: node-skeleton
5 | spec:
6 | selector:
7 | app: node-skeleton
8 | type: LoadBalancer
9 | ports:
10 | - name: http
11 | protocol: TCP
12 | port: 8085
13 | targetPort: 8085
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### Version 1.0.0
2 |
3 | - Initial checkin of the project
4 |
5 | ### Version 1.1.0 - In Progress
6 |
7 | - Added Travis CI
8 | - Added DockerHub support (pull request #8 by tvvignesh)
9 | - Added CHANGELOG to track changes
10 | - Helper Utils and functions added for JWT
11 |
--------------------------------------------------------------------------------
/src/app/controllers/api.server.controller.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * SAMPLE FUNCTION - CAN BE REMOVED
3 | * @param req Request
4 | * @param res Response
5 | */
6 | export const helloWorld = function (req, res) {
7 | return res.status(200).jsonp({
8 | message: 'Hello World!'
9 | });
10 | };
11 |
--------------------------------------------------------------------------------
/dist/app/controllers/api.server.controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.helloWorld = function (req, res) {
4 | return res.status(200).jsonp({
5 | message: 'Hello World!'
6 | });
7 | };
8 | //# sourceMappingURL=api.server.controller.js.map
--------------------------------------------------------------------------------
/dist/app/controllers/api.server.controller.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"api.server.controller.js","sourceRoot":"","sources":["../../../src/app/controllers/api.server.controller.ts"],"names":[],"mappings":";;AAKa,QAAA,UAAU,GAAG,UAAU,GAAG,EAAE,GAAG;IACxC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;QACzB,OAAO,EAAE,cAAc;KAC1B,CAAC,CAAC;AACP,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/config/env/all.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | module.exports = {
3 | app: {
4 | title: 'Node Skeleton',
5 | description: 'Node Skeleton boilerplate',
6 | url: 'http://localhost'
7 | },
8 | port: process.env.NODEJS_PORT || 8081,
9 | hostname: process.env.NODEJS_IP || 'localhost'
10 | };
11 | //# sourceMappingURL=all.js.map
--------------------------------------------------------------------------------
/dist/config/env/all.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"all.js","sourceRoot":"","sources":["../../../src/config/env/all.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,GAAG;IACb,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,2BAA2B;QACxC,GAAG,EAAE,kBAAkB;KAC1B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;CACjD,CAAC"}
--------------------------------------------------------------------------------
/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "restartable": "rs",
3 | "ignore": [".git", "node_modules/**/node_modules", "logs/", "dist/"],
4 | "verbose": true,
5 | "env": {
6 | "NODE_ENV": "development"
7 | },
8 | "ext": "ts,js,html,json,yml,css",
9 | "exec": "npm run build && npm run lint && node --harmony ./dist/server.js",
10 | "delay": "2500"
11 | }
12 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Submitting Pull Requests
2 |
3 | If you're changing the modules being used please create an issue first.
4 |
5 | ## Submitting bug reports
6 |
7 | Make sure you are on latest changes and that you ran this command `npm run install` after updating your local repository. If you can, please provide more information about your environment such as operating system, node version, and npm version.
8 |
--------------------------------------------------------------------------------
/dist/tests/test.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/tests/test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAAuB;AAEvB,aAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;IACd,CAAC,CAAC,IAAI,EAAE,CAAC;AACb,CAAC,CAAC,CAAC;AAEH,aAAI,CAAC,KAAK,EAAE,CAAO,CAAC,EAAE,EAAE;IACpB,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEnC,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC;AAC3B,CAAC,CAAA,CAAC,CAAC"}
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG app_port
2 | ARG debug_port
3 | # ARG app_db
4 |
5 | FROM node:12-alpine
6 | # ENV NODE_ENV $app_env
7 | # ENV MONGO_HOST $app_db
8 | # ENV NODEJS_IP "0.0.0.0"
9 | RUN mkdir -p /app/server
10 | WORKDIR /app/server
11 | COPY . /app/server
12 | RUN npm install -g typescript nodemon
13 | RUN npm install
14 | RUN npm run-script build
15 | EXPOSE $app_port
16 | EXPOSE $debug_port
17 | CMD [ "npm", "start" ]
18 |
--------------------------------------------------------------------------------
/kubernetes/deployment.yml:
--------------------------------------------------------------------------------
1 | apiVersion: extensions/v1beta1
2 | kind: Deployment
3 | metadata:
4 | name: node-skeleton
5 | labels:
6 | app: node-skeleton
7 | spec:
8 | replicas: 3
9 | template:
10 | metadata:
11 | labels:
12 | app: node-skeleton
13 | spec:
14 | containers:
15 | - name: node-skeleton
16 | image: tvvignesh/node-skeleton
17 | ports:
18 | - containerPort: 8085
--------------------------------------------------------------------------------
/dist/app/routes/root.server.routes.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"root.server.routes.js","sourceRoot":"","sources":["../../../src/app/routes/root.server.routes.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG;IAG1B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,EAAE,GAAG;QAC3B,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE;YAChB,IAAI,EAAE;gBACF,KAAK,EAAE,aAAa;aACvB;YACD,OAAO,EAAE;gBACL,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,oBAAoB;aACpC;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAIP,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/app/routes/root.server.routes.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | module.exports = function (app) {
3 | app.get('/', function (req, res) {
4 | res.render('index', {
5 | head: {
6 | title: 'Hello World'
7 | },
8 | content: {
9 | title: 'Hi there!',
10 | description: 'You are all set up'
11 | }
12 | });
13 | });
14 | };
15 | //# sourceMappingURL=root.server.routes.js.map
--------------------------------------------------------------------------------
/dist/app/routes/api.server.routes.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"api.server.routes.js","sourceRoot":"","sources":["../../../src/app/routes/api.server.routes.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,wFAAsE;AACtE,kFAI+C;AAC/C,gFAAkE;AAElE,MAAM,CAAC,OAAO,GAAG,UAAU,GAAG;IAC1B,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,qCAAY,EAAE,kCAAU,CAAC,CAAC;IAEnD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,qCAAY,EAAE,sCAAa,EAAE,kCAAU,CAAC,CAAC;IAEjE,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,sCAAU,CAAC,CAAC;AAI1C,CAAC,CAAC"}
--------------------------------------------------------------------------------
/creds/jwtRS512.key:
--------------------------------------------------------------------------------
1 | -----BEGIN RSA PRIVATE KEY-----
2 | MIIBOgIBAAJBANZR6QCmHaXu9PjukLm8m4y0YD3DDsLjXznG4WggyMTblClQOy4H
3 | QcenL/JtSXDKQmWCZHrtMmEiBFouoTecffUCAwEAAQJBAJOGnpTLw+zMp+QSk5zG
4 | r2wTXYwmEKsmSA5FUDOVHZ4jJBvWztCzSVUVSfsc95eJJ1wgxSSrGLjf0jKKGvXD
5 | ZAECIQD/GYMqJEHXDj8k8Ck4BJ7AHdmJDWQbfZ+oUPHKwUkSYQIhANcTjXLfuHeG
6 | QCSzsA4Jmz1tKF+NClpISjrhzsLxF3wVAiAqAeF/hwjwiQAM7R9cgiZCLKgt0W6y
7 | uDUaWnn2kW2fAQIgeAo/rlfTe1KAxntLzenqrTQZjosHtjAWzhpt7jvloakCIC5L
8 | VNdW9EUZbpl0H+AWwfMxcYFlNRqzCkKsbBFtuXMI
9 | -----END RSA PRIVATE KEY-----
--------------------------------------------------------------------------------
/src/app/routes/root.server.routes.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function (app) {
4 | // var authCtrl = require('../../app/controllers/auth.server.controller');
5 |
6 | app.get('/', function (req, res) {
7 | res.render('index', {
8 | head: {
9 | title: 'Hello World'
10 | },
11 | content: {
12 | title: 'Hi there!',
13 | description: 'You are all set up'
14 | }
15 | });
16 | });
17 |
18 | // Set params if needed
19 | // app.param('Id', apiCtrl.func);
20 | };
21 |
--------------------------------------------------------------------------------
/dist/config/logger.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, '__esModule', { value: true });
3 | const logger = require('winston');
4 | let now = new Date();
5 | let dateStr = now.toISOString();
6 | if (process.env.NODE_ENV === 'development') {
7 | logger.configure({
8 | transports: [new logger.transports.Console()]
9 | });
10 | } else {
11 | logger.configure({
12 | transports: [
13 | new logger.transports.File({ filename: 'logs/' + dateStr + '.log' })
14 | ]
15 | });
16 | }
17 | module.exports = logger;
18 | //# sourceMappingURL=logger.js.map
19 |
--------------------------------------------------------------------------------
/dist/config/logger.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/config/logger.ts"],"names":[],"mappings":";;AAAA,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAElC,IAAI,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AACrB,IAAI,OAAO,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;AAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;IACxC,MAAM,CAAC,SAAS,CAAC;QACb,UAAU,EAAE;YACR,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE;SAClC;KACJ,CAAC,CAAC;CACN;KAAM;IACH,MAAM,CAAC,SAAS,CAAC;QACb,UAAU,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC;SACzE;KACJ,CAAC,CAAC;CACN;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC"}
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "search.exclude": {
3 | "**/node_modules": true,
4 | "**/bower_components": true,
5 | "**/dist": true
6 | },
7 | "editor.formatOnSave": true,
8 | "editor.detectIndentation": false,
9 | "eslint.enable": true,
10 | "eslint.lintTask.enable": true,
11 | "eslint.alwaysShowStatus": true,
12 | "eslint.validate": ["typescript","typescriptreact",
13 | "javascript",
14 | "javascriptreact"
15 | ],
16 | "telemetry.enableCrashReporter": false,
17 | "telemetry.enableTelemetry": false,
18 | "editor.insertSpaces": false,
19 | "editor.codeActionsOnSave": {
20 | "source.fixAll.eslint": true
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/app/routes/api.server.routes.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | import { getMetrics } from '../controllers/metrics.server.controller';
4 | import {
5 | authenticate,
6 | resolveToken,
7 | resolveSecret
8 | } from '../controllers/auth.server.controller';
9 | import { helloWorld } from '../controllers/api.server.controller';
10 |
11 | module.exports = function (app) {
12 | app.route('/hello').post(authenticate, helloWorld);
13 |
14 | app.route('/hello').get(resolveToken, resolveSecret, helloWorld);
15 |
16 | app.route('/metrics').get(getMetrics);
17 |
18 | // Set params if needed
19 | // app.param('Id', apiCtrl.func);
20 | };
21 |
--------------------------------------------------------------------------------
/dist/server.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | require('dotenv').config();
4 | if (!process.env.NODE_ENV) {
5 | process.env.NODE_ENV = 'production';
6 | }
7 | const config_1 = require("./config/config");
8 | let app = require('./config/express')();
9 | process.on('uncaughtException', function (err) {
10 | console.log('Error:', err);
11 | });
12 | app.get('server').listen(config_1.config.port);
13 | exports = module.exports = app;
14 | console.log(`${config_1.config.app.title} started on ${config_1.config.hostname} : ${config_1.config.port} in ${process.env.NODE_ENV} mode on ${new Date().toISOString()}`);
15 | //# sourceMappingURL=server.js.map
--------------------------------------------------------------------------------
/dist/server.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;IACvB,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;CACvC;AAED,4CAAyC;AAGzC,IAAI,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAExC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,UAAU,GAAG;IACzC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC;AAGH,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,eAAM,CAAC,IAAI,CAAC,CAAC;AAGtC,OAAO,GAAG,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;AAG/B,OAAO,CAAC,GAAG,CACP,GAAG,eAAM,CAAC,GAAG,CAAC,KAAK,eAAe,eAAM,CAAC,QAAQ,MAAM,eAAM,CAAC,IAAI,OAC9D,OAAO,CAAC,GAAG,CAAC,QAChB,YAAY,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CACzC,CAAC"}
--------------------------------------------------------------------------------
/src/server.ts:
--------------------------------------------------------------------------------
1 | require('dotenv').config();
2 |
3 | if (!process.env.NODE_ENV) {
4 | process.env.NODE_ENV = 'production';
5 | }
6 |
7 | import { config } from './config/config';
8 |
9 | // Init the express application
10 | let app = require('./config/express')();
11 |
12 | process.on('uncaughtException', function (err) {
13 | console.log('Error:', err);
14 | });
15 |
16 | // Start the app by listening on
17 | app.get('server').listen(config.port);
18 |
19 | // Expose app
20 | exports = module.exports = app;
21 |
22 | // Logging initialization
23 | console.log(
24 | `${config.app.title} started on ${config.hostname} : ${config.port} in ${
25 | process.env.NODE_ENV
26 | } mode on ${new Date().toISOString()}`
27 | );
28 |
--------------------------------------------------------------------------------
/docker-compose-prod.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 |
3 | services:
4 | app-server:
5 | env_file:
6 | - ./.env
7 | build:
8 | context: .
9 | dockerfile: Dockerfile-prod
10 | args:
11 | app_port: ${NODEJS_PORT}
12 | debug_port: ${DEBUG}
13 | # app_db: app-db:30000
14 | # app_env: alpha
15 | command: npm run start
16 | container_name: app-server
17 | restart: always
18 | ports:
19 | - "${SEVER_PORT}"
20 | - "${DEBUG_PORT}"
21 | # links:
22 | # - app-db
23 | # app-db:
24 | # container_name: app-db
25 | # image: mongo:3.6.5
26 | # ports:
27 | # - "30000:27017"
28 | # volumes:
29 | # - mongodata:/data/db
30 | # volumes:
31 | # mongodata:
32 | # driver: local
33 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | "declaration": false,
5 | "target": "es6",
6 | "module": "commonjs",
7 | "noImplicitAny": false,
8 | "moduleResolution": "node",
9 | "noUnusedLocals": true,
10 | "removeComments": true,
11 | "preserveConstEnums": true,
12 | "allowSyntheticDefaultImports": true,
13 | "sourceMap": true,
14 | "outDir": "dist",
15 | "baseUrl": "./",
16 | "lib": [
17 | "es2015",
18 | "esnext.asynciterable"
19 | ]
20 | },
21 | "include": [
22 | "src/**/*"
23 | ],
24 | "exclude": [
25 | "node_modules",
26 | "**/*.spec.ts",
27 | "**/*.d.ts"
28 | ]
29 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig for this project
2 | root = true
3 |
4 | # Unix-style newlines with a newline ending every file
5 | [*]
6 | insert_final_newline = true
7 | end_of_line = lf
8 | charset = utf-8
9 | trim_trailing_whitespace = true
10 | indent_style = space
11 | indent_size = 4
12 |
13 | # Matches multiple files with brace expansion notation
14 | # Set default charset
15 | [*.{js,py,ts}]
16 | charset = utf-8
17 |
18 | [*.ts]
19 | indent_style = space
20 | indent_size = 4
21 |
22 | [{*.json,*.md,*.yml}]
23 | indent_style = space
24 | indent_size = 2
25 |
26 | # 4 space indentation
27 | [*.py]
28 | indent_style = space
29 | indent_size = 4
30 |
31 | # Space indentation (no size specified)
32 | [Makefile]
33 | indent_style = space
34 |
35 | [*.md]
36 | trim_trailing_whitespace = false
37 |
--------------------------------------------------------------------------------
/dist/app/routes/api.server.routes.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const metrics_server_controller_1 = require("../controllers/metrics.server.controller");
4 | const auth_server_controller_1 = require("../controllers/auth.server.controller");
5 | const api_server_controller_1 = require("../controllers/api.server.controller");
6 | module.exports = function (app) {
7 | app.route('/hello').post(auth_server_controller_1.authenticate, api_server_controller_1.helloWorld);
8 | app.route('/hello').get(auth_server_controller_1.resolveToken, auth_server_controller_1.resolveSecret, api_server_controller_1.helloWorld);
9 | app.route('/metrics').get(metrics_server_controller_1.getMetrics);
10 | };
11 | //# sourceMappingURL=api.server.routes.js.map
--------------------------------------------------------------------------------
/dist/config/init.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/config/init.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAKb,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,EACtB,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAK7B,MAAM,CAAC,OAAO,GAAG;IAMb,IAAI,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAC5B,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,KAAK,CACjD,CAAC;IACF,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;YACtB,OAAO,CAAC,KAAK,CACT,KAAK,CAAC,GAAG,CACL,mCAAmC;gBAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ;gBACpB,yCAAyC,CAChD,CACJ,CAAC;SACL;aAAM;YACH,OAAO,CAAC,KAAK,CACT,KAAK,CAAC,GAAG,CACL,gEAAgE,CACnE,CACJ,CAAC;SACL;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,aAAa,CAAC;KACxC;SAAM;QACH,OAAO,CAAC,GAAG,CACP,KAAK,CAAC,KAAK,CAAC,OAAO,CACf,gCAAgC;YAC5B,OAAO,CAAC,GAAG,CAAC,QAAQ;YACpB,6BAA6B,CACpC,CACJ,CAAC;KACL;AACL,CAAC,CAAC"}
--------------------------------------------------------------------------------
/typedoc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | name: 'Documentation',
3 | readme: './README.md',
4 | hideGenerator: 'true',
5 | mode: 'modules',
6 | out: 'docs',
7 | exclude: ['src/tests/**/*', 'node_modules/**/*', 'dist/**/*'],
8 | theme: 'default',
9 | ignoreCompilerErrors: 'true',
10 | experimentalDecorators: 'true',
11 | excludePrivate: 'true',
12 | target: 'ES6',
13 | moduleResolution: 'node',
14 | emitDecoratorMetadata: 'true',
15 | preserveConstEnums: 'true',
16 | stripInternal: 'true',
17 | suppressExcessPropertyErrors: 'true',
18 | suppressImplicitAnyIndexErrors: 'true',
19 | module: 'commonjs',
20 | excludeExternals: 'true',
21 | externalPattern: 'node_modules',
22 | includeDeclarations: 'false',
23 | verbose: 'true'
24 | };
25 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 |
3 | services:
4 | app-server:
5 | env_file:
6 | - ./.env
7 | build:
8 | context: .
9 | dockerfile: Dockerfile
10 | args:
11 | app_port: ${NODEJS_PORT}
12 | debug_port: ${DEBUG}
13 | # app_db: app-db:30000
14 | # app_env: alpha
15 | command: npm run debug
16 | container_name: app-server
17 | restart: always
18 | volumes:
19 | - ./src:/app/server/src
20 | ports:
21 | - "${SEVER_PORT}"
22 | - "${DEBUG_PORT}"
23 | # links:
24 | # - app-db
25 | # app-db:
26 | # container_name: app-db
27 | # image: mongo:3.6.5
28 | # ports:
29 | # - "30000:27017"
30 | # volumes:
31 | # - mongodata:/data/db
32 | # volumes:
33 | # mongodata:
34 | # driver: local
35 |
--------------------------------------------------------------------------------
/pm2-dev.json:
--------------------------------------------------------------------------------
1 | {
2 | "apps": [
3 | {
4 | "name": "node-skeleton",
5 | "script": "./dist/server.js",
6 | "exec_mode": "cluster",
7 | "instances": 0,
8 | "merge_logs": true,
9 | "log_type": "json",
10 | "max_memory_restart": "500M",
11 | "max_restarts": "100",
12 | "output": "./logs/out.log",
13 | "error": "./logs/error.log",
14 | "dependencies": [
15 | "pm2-logrotate"
16 | ],
17 | "node_args": "--harmony",
18 | "watch": true,
19 | "ignore_watch": [
20 | "./node_modules",
21 | "./logs"
22 | ],
23 | "env": {
24 | "NODE_ENV": "development",
25 | "NODEJS_PORT": "8085"
26 | }
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/Dockerfile-prod:
--------------------------------------------------------------------------------
1 | ARG app_port
2 |
3 | FROM node:12-alpine as builder
4 | RUN npm install -g typescript
5 | RUN mkdir -p /app/server
6 | WORKDIR /app/server
7 | COPY . /app/server
8 | RUN npm install
9 | RUN npm run-script build
10 | RUN rm -rf node_modules
11 | RUN npm install --production
12 |
13 | FROM node:12-alpine
14 |
15 | RUN mkdir -p /app/server
16 | WORKDIR /app/server
17 | COPY --from=builder /app/server/creds creds
18 | COPY --from=builder /app/server/apidoc.yaml ./apidoc.yaml
19 | COPY --from=builder /app/server/README.md ./README.md
20 | COPY --from=builder /app/server/Makefile ./Makefile
21 | COPY --from=builder /app/server/package.json ./package.json
22 | COPY --from=builder /app/server/node_modules node_modules
23 | COPY --from=builder /app/server/logs logs
24 | COPY --from=builder /app/server/dist dist
25 |
26 | EXPOSE $app_port
27 | EXPOSE $debug_port
28 | CMD [ "npm", "start" ]
29 |
--------------------------------------------------------------------------------
/dist/config/config.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEF,QAAA,MAAM,GAAG;IAChB,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,eAAe;QAC5B,GAAG,EAAE,uBAAuB;KAC/B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;IAC9C,aAAa,EAAE,eAAe;IAE9B,GAAG,EAAE;QACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe;KACpD;IAED,MAAM,EAAE;QACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;QACzC,GAAG,EAAE;YACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;SAC9C;KACJ;IAED,MAAM,EAAE;QACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;KACxC;IAED,EAAE,EAAE;QACA,KAAK,EAAE;YACH,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE;oBACL,iBAAiB,EAAE,KAAK;iBAC3B;aACJ;SACJ;KACJ;CACJ,CAAC"}
--------------------------------------------------------------------------------
/dist/config/env/alpha.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"alpha.js","sourceRoot":"","sources":["../../../src/config/env/alpha.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEF,QAAA,MAAM,GAAG;IAChB,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,eAAe;QAC5B,GAAG,EAAE,uBAAuB;KAC/B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;IAC9C,aAAa,EAAE,eAAe;IAE9B,GAAG,EAAE;QACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe;KACpD;IAED,MAAM,EAAE;QACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;QACzC,GAAG,EAAE;YACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;SAC9C;KACJ;IAED,MAAM,EAAE;QACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;KACxC;IAED,EAAE,EAAE;QACA,KAAK,EAAE;YACH,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE;oBACL,iBAAiB,EAAE,KAAK;iBAC3B;aACJ;SACJ;KACJ;CACJ,CAAC"}
--------------------------------------------------------------------------------
/dist/config/env/secure.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"secure.js","sourceRoot":"","sources":["../../../src/config/env/secure.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEF,QAAA,MAAM,GAAG;IAChB,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,eAAe;QAC5B,GAAG,EAAE,uBAAuB;KAC/B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;IAC9C,aAAa,EAAE,eAAe;IAE9B,GAAG,EAAE;QACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe;KACpD;IAED,MAAM,EAAE;QACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;QACzC,GAAG,EAAE;YACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;SAC9C;KACJ;IAED,MAAM,EAAE;QACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;KACxC;IAED,EAAE,EAAE;QACA,KAAK,EAAE;YACH,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE;oBACL,iBAAiB,EAAE,KAAK;iBAC3B;aACJ;SACJ;KACJ;CACJ,CAAC"}
--------------------------------------------------------------------------------
/dist/config/env/production.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"production.js","sourceRoot":"","sources":["../../../src/config/env/production.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEF,QAAA,MAAM,GAAG;IAChB,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,eAAe;QAC5B,GAAG,EAAE,uBAAuB;KAC/B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;IAC9C,aAAa,EAAE,eAAe;IAE9B,GAAG,EAAE;QACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe;KACpD;IAED,MAAM,EAAE;QACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;QACzC,GAAG,EAAE;YACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;SAC9C;KACJ;IAED,MAAM,EAAE;QACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;KACxC;IAED,EAAE,EAAE;QACA,KAAK,EAAE;YACH,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE;oBACL,iBAAiB,EAAE,KAAK;iBAC3B;aACJ;SACJ;KACJ;CACJ,CAAC"}
--------------------------------------------------------------------------------
/dist/config/env/development.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"development.js","sourceRoot":"","sources":["../../../src/config/env/development.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEF,QAAA,MAAM,GAAG;IAChB,GAAG,EAAE;QACD,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,eAAe;QAC5B,GAAG,EAAE,uBAAuB;KAC/B;IACD,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;IACrC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,WAAW;IAC9C,aAAa,EAAE,eAAe;IAE9B,GAAG,EAAE;QACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,eAAe;KACpD;IAED,MAAM,EAAE;QACJ,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;QACzC,GAAG,EAAE;YACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,KAAK;YAC3C,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,IAAI;SAC9C;KACJ;IAED,MAAM,EAAE;QACJ,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,WAAW;QAC5C,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI;KACxC;IAED,EAAE,EAAE;QACA,KAAK,EAAE;YACH,IAAI,EAAE;gBACF,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,EAAE;gBACZ,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,EAAE;gBACZ,OAAO,EAAE;oBACL,iBAAiB,EAAE,KAAK;iBAC3B;aACJ;SACJ;KACJ;CACJ,CAAC"}
--------------------------------------------------------------------------------
/dist/config/init.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | let glob = require('glob'), chalk = require('chalk');
4 | module.exports = function () {
5 | let environmentFiles = glob.sync('./config/env/' + process.env.NODE_ENV + '.js');
6 | if (!environmentFiles.length) {
7 | if (process.env.NODE_ENV) {
8 | console.error(chalk.red('No configuration file found for "' +
9 | process.env.NODE_ENV +
10 | '" environment using development instead'));
11 | }
12 | else {
13 | console.error(chalk.red('NODE_ENV is not defined! Using default development environment'));
14 | }
15 | process.env.NODE_ENV = 'development';
16 | }
17 | else {
18 | console.log(chalk.black.bgWhite('Application loaded using the "' +
19 | process.env.NODE_ENV +
20 | '" environment configuration'));
21 | }
22 | };
23 | //# sourceMappingURL=init.js.map
--------------------------------------------------------------------------------
/dist/tests/test.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | const ava_1 = require("ava");
13 | ava_1.default('foo', (t) => {
14 | t.pass();
15 | });
16 | ava_1.default('bar', (t) => __awaiter(void 0, void 0, void 0, function* () {
17 | const bar = Promise.resolve('bar');
18 | t.is(yield bar, 'bar');
19 | }));
20 | //# sourceMappingURL=test.js.map
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "tsc-watch",
6 | "type": "shell",
7 | "command": "npm",
8 | "group": "build",
9 | "args": [
10 | "run",
11 | "watch"
12 | ],
13 | "presentation": {
14 | "reveal": "always",
15 | "panel": "new"
16 | },
17 | "problemMatcher": [
18 | "$tsc-watch"
19 | ],
20 | "isBackground": true
21 | },
22 | {
23 | "label": "Run-eslint",
24 | "type": "shell",
25 | "linux": {
26 | // "command": "./node_modules/.bin/eslint -f stylish ./**"
27 | "command": "./node_modules/.bin/eslint --ext=.js,.ts . --fix"
28 | },
29 | "presentation": {
30 | "reveal": "always",
31 | "panel": "shared"
32 | },
33 | "problemMatcher": [
34 | "$eslint-stylish"
35 | ],
36 | "isBackground": true
37 | }
38 | ]
39 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright 2018 Vignesh T.V. https://www.tvvignesh.com
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/src/config/config.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | export let config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 |
13 | jwt: {
14 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
15 | },
16 |
17 | toggle: {
18 | apidoc: process.env.TOGGLE_APIDOC || true,
19 | log: {
20 | files: process.env.ENABLE_LOG_FILE || false,
21 | console: process.env.ENABLE_CONSOLE || true
22 | }
23 | },
24 |
25 | jaeger: {
26 | host: process.env.JAEGER_HOST || 'localhost',
27 | port: process.env.JAEGER_PORT || 6832
28 | },
29 |
30 | db: {
31 | mssql: {
32 | root: {
33 | user: '',
34 | password: '',
35 | server: '',
36 | database: '',
37 | options: {
38 | trustedConnection: false
39 | }
40 | }
41 | }
42 | }
43 | };
44 |
--------------------------------------------------------------------------------
/dist/app/utils/api.utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"api.utils.js","sourceRoot":"","sources":["../../../src/app/utils/api.utils.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,+CAAoC;AACpC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAU1C,QAAA,OAAO,GAAG,UAAgB,UAAU,EAAE,IAAI;;QACnD,IAAI,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5E,IAAI;YACA,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI;gBACvC,MAAM,EAAE,gCAAgC;aAC3C,CAAC;YAEF,UAAU,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,MAAM,CAAC;YAE5D,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,MAAM,CAAC;YAEhD,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CACnB,WAAW,EACX,mBAAmB,EACnB,UAAU,CAAC,OAAO,CACrB,CAAC;YAEF,iBAAG,CAAC,MAAM,EAAE;gBACR,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,UAAU,CAAC,GAAG;aACtB,CAAC,CAAC;YAEH,IAAI,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;YAEvC,WAAW,CAAC,MAAM,EAAE,CAAC;YAErB,OAAO;gBACH,GAAG,EAAE,IAAI;gBACT,QAAQ,EAAE,QAAQ,CAAC,IAAI;gBACvB,IAAI,EAAE,WAAW;aACpB,CAAC;SACL;QAAC,OAAO,GAAG,EAAE;YACV,iBAAG,CACC,OAAO,EACP;gBACI,OAAO,EAAE,sBAAsB;gBAC/B,GAAG,EAAE,UAAU,CAAC,GAAG;gBACnB,GAAG,EAAE,GAAG;aACX,EACD,WAAW,CACd,CAAC;YAEF,WAAW,CAAC,MAAM,EAAE,CAAC;YAErB,OAAO;gBACH,GAAG,EAAE,GAAG;gBACR,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,WAAW;aACpB,CAAC;SACL;IACL,CAAC;CAAA,CAAC"}
--------------------------------------------------------------------------------
/dist/config/config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 | jwt: {
13 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
14 | },
15 | toggle: {
16 | apidoc: process.env.TOGGLE_APIDOC || true,
17 | log: {
18 | files: process.env.ENABLE_LOG_FILE || false,
19 | console: process.env.ENABLE_CONSOLE || true
20 | }
21 | },
22 | jaeger: {
23 | host: process.env.JAEGER_HOST || 'localhost',
24 | port: process.env.JAEGER_PORT || 6832
25 | },
26 | db: {
27 | mssql: {
28 | root: {
29 | user: '',
30 | password: '',
31 | server: '',
32 | database: '',
33 | options: {
34 | trustedConnection: false
35 | }
36 | }
37 | }
38 | }
39 | };
40 | //# sourceMappingURL=config.js.map
--------------------------------------------------------------------------------
/dist/config/env/alpha.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 | jwt: {
13 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
14 | },
15 | toggle: {
16 | apidoc: process.env.TOGGLE_APIDOC || true,
17 | log: {
18 | files: process.env.ENABLE_LOG_FILE || false,
19 | console: process.env.ENABLE_CONSOLE || true
20 | }
21 | },
22 | jaeger: {
23 | host: process.env.JAEGER_HOST || 'localhost',
24 | port: process.env.JAEGER_PORT || 6832
25 | },
26 | db: {
27 | mssql: {
28 | root: {
29 | user: '',
30 | password: '',
31 | server: '',
32 | database: '',
33 | options: {
34 | trustedConnection: false
35 | }
36 | }
37 | }
38 | }
39 | };
40 | //# sourceMappingURL=alpha.js.map
--------------------------------------------------------------------------------
/dist/config/env/secure.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 | jwt: {
13 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
14 | },
15 | toggle: {
16 | apidoc: process.env.TOGGLE_APIDOC || true,
17 | log: {
18 | files: process.env.ENABLE_LOG_FILE || false,
19 | console: process.env.ENABLE_CONSOLE || true
20 | }
21 | },
22 | jaeger: {
23 | host: process.env.JAEGER_HOST || 'localhost',
24 | port: process.env.JAEGER_PORT || 6832
25 | },
26 | db: {
27 | mssql: {
28 | root: {
29 | user: '',
30 | password: '',
31 | server: '',
32 | database: '',
33 | options: {
34 | trustedConnection: false
35 | }
36 | }
37 | }
38 | }
39 | };
40 | //# sourceMappingURL=secure.js.map
--------------------------------------------------------------------------------
/dist/config/env/development.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 | jwt: {
13 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
14 | },
15 | toggle: {
16 | apidoc: process.env.TOGGLE_APIDOC || true,
17 | log: {
18 | files: process.env.ENABLE_LOG_FILE || false,
19 | console: process.env.ENABLE_CONSOLE || true
20 | }
21 | },
22 | jaeger: {
23 | host: process.env.JAEGER_HOST || 'localhost',
24 | port: process.env.JAEGER_PORT || 6832
25 | },
26 | db: {
27 | mssql: {
28 | root: {
29 | user: '',
30 | password: '',
31 | server: '',
32 | database: '',
33 | options: {
34 | trustedConnection: false
35 | }
36 | }
37 | }
38 | }
39 | };
40 | //# sourceMappingURL=development.js.map
--------------------------------------------------------------------------------
/dist/config/env/production.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | exports.config = {
4 | app: {
5 | title: 'Node Skeleton',
6 | description: 'Node Skeleton',
7 | url: 'http://localhost:8085'
8 | },
9 | port: process.env.NODEJS_PORT || 8085,
10 | hostname: process.env.NODEJS_IP || 'localhost',
11 | authorization: 'mysecrettoken',
12 | jwt: {
13 | issuer: process.env.JWT_ISSUER || 'node-skeleton'
14 | },
15 | toggle: {
16 | apidoc: process.env.TOGGLE_APIDOC || true,
17 | log: {
18 | files: process.env.ENABLE_LOG_FILE || false,
19 | console: process.env.ENABLE_CONSOLE || true
20 | }
21 | },
22 | jaeger: {
23 | host: process.env.JAEGER_HOST || 'localhost',
24 | port: process.env.JAEGER_PORT || 6832
25 | },
26 | db: {
27 | mssql: {
28 | root: {
29 | user: '',
30 | password: '',
31 | server: '',
32 | database: '',
33 | options: {
34 | trustedConnection: false
35 | }
36 | }
37 | }
38 | }
39 | };
40 | //# sourceMappingURL=production.js.map
--------------------------------------------------------------------------------
/dist/app/utils/auth.utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"auth.utils.js","sourceRoot":"","sources":["../../../src/app/utils/auth.utils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,EACxB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAEpC,IAAI,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE5C,IAAI,UAAU,GAAG,EAAE,CAAC,YAAY,CACxB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,EACnD,MAAM,CACT,EACD,SAAS,GAAG,EAAE,CAAC,YAAY,CACvB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iCAAiC,CAAC,EACvD,MAAM,CACT,CAAC;AAEO,QAAA,OAAO,GAAG,UAAU,OAAO,EAAE,QAAQ;IAS9C,IAAI,WAAW,GAAG;QACd,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM;QAC5C,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,OAAO;QAClB,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,SAAS;QACtC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,SAAS;KAC3C,CAAC;IAEF,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AACtD,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG,UAAU,KAAK,EAAE,QAAQ;IAQ9C,IAAI,aAAa,GAAG;QAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM;QAC5C,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,SAAS;QACtC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,SAAS;QACxC,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC,OAAO,CAAC;KACvB,CAAC;IAEF,IAAI;QACA,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;KACtD;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG,UAAU,KAAK;IACpC,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjD,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/app/utils/error.utils.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const { Tags } = require('opentracing');
4 | const config_1 = require("../../config/config");
5 | const logger = require('winston');
6 | let transports = [];
7 | let dateStr = new Date().toISOString();
8 | if (config_1.config.toggle.log.files) {
9 | transports.push(new logger.transports.File({
10 | filename: 'logs/' + dateStr + '-error.log',
11 | level: 'error'
12 | }));
13 | transports.push(new logger.transports.File({
14 | filename: 'logs/' + dateStr + '-info.log',
15 | level: 'info'
16 | }));
17 | }
18 | if (config_1.config.toggle.log.console) {
19 | transports.push(new logger.transports.Console());
20 | }
21 | logger.configure({
22 | transports: transports
23 | });
24 | exports.log = function (level, payload, span = undefined, tagObj = undefined) {
25 | if (span && tagObj) {
26 | for (let tag in tagObj) {
27 | if (Object.prototype.hasOwnProperty.call(tagObj, tag)) {
28 | span.setTag(tag, tagObj[tag]);
29 | }
30 | }
31 | }
32 | if (span && level === 'error') {
33 | span.setTag(Tags.ERROR, true);
34 | }
35 | logger.log(level, JSON.stringify(payload));
36 | if (span) {
37 | span.log(payload);
38 | }
39 | };
40 | //# sourceMappingURL=error.utils.js.map
--------------------------------------------------------------------------------
/dist/app/utils/error.utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"error.utils.js","sourceRoot":"","sources":["../../../src/app/utils/error.utils.ts"],"names":[],"mappings":";;AAAA,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACxC,gDAA6C;AAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAElC,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB,IAAI,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAEvC,IAAI,eAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;IACzB,UAAU,CAAC,IAAI,CACX,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;QACvB,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,YAAY;QAC1C,KAAK,EAAE,OAAO;KACjB,CAAC,CACL,CAAC;IAEF,UAAU,CAAC,IAAI,CACX,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;QACvB,QAAQ,EAAE,OAAO,GAAG,OAAO,GAAG,WAAW;QACzC,KAAK,EAAE,MAAM;KAChB,CAAC,CACL,CAAC;CACL;AAED,IAAI,eAAM,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE;IAC3B,UAAU,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;CACpD;AAED,MAAM,CAAC,SAAS,CAAC;IACb,UAAU,EAAE,UAAU;CACzB,CAAC,CAAC;AAKU,QAAA,GAAG,GAAG,UACf,KAAK,EACL,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,MAAM,GAAG,SAAS;IAElB,IAAI,IAAI,IAAI,MAAM,EAAE;QAChB,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;YACpB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;gBACnD,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;aACjC;SACJ;KACJ;IAED,IAAI,IAAI,IAAI,KAAK,KAAK,OAAO,EAAE;QAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;KACjC;IAED,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3C,IAAI,IAAI,EAAE;QACN,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;KACrB;AACL,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/app/utils/auth.utils.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const path = require('path'), fs = require('fs');
4 | const jwt = require('jsonwebtoken');
5 | let config = require('../../config/config');
6 | let privateKEY = fs.readFileSync(path.join(__dirname, '../../../creds/jwtRS512.key'), 'utf8'), publicKEY = fs.readFileSync(path.join(__dirname, '../../../creds/jwtRS512.key.pub'), 'utf8');
7 | exports.signJWT = function (payload, $Options) {
8 | let signOptions = {
9 | issuer: $Options.issuer || config.jwt.issuer,
10 | expiresIn: '30d',
11 | algorithm: 'RS512',
12 | subject: $Options.subject || undefined,
13 | audience: $Options.audience || undefined
14 | };
15 | return jwt.sign(payload, privateKEY, signOptions);
16 | };
17 | exports.verifyJWT = function (token, $Options) {
18 | let verifyOptions = {
19 | issuer: $Options.issuer || config.jwt.issuer,
20 | subject: $Options.subject || undefined,
21 | audience: $Options.audience || undefined,
22 | expiresIn: '30d',
23 | algorithm: ['RS512']
24 | };
25 | try {
26 | return jwt.verify(token, publicKEY, verifyOptions);
27 | }
28 | catch (err) {
29 | return false;
30 | }
31 | };
32 | exports.decodeJWT = function (token) {
33 | return jwt.decode(token, { complete: true });
34 | };
35 | //# sourceMappingURL=auth.utils.js.map
--------------------------------------------------------------------------------
/src/app/utils/error.utils.ts:
--------------------------------------------------------------------------------
1 | const { Tags } = require('opentracing');
2 | import { config } from '../../config/config';
3 | const logger = require('winston');
4 |
5 | let transports = [];
6 |
7 | let dateStr = new Date().toISOString();
8 |
9 | if (config.toggle.log.files) {
10 | transports.push(
11 | new logger.transports.File({
12 | filename: 'logs/' + dateStr + '-error.log',
13 | level: 'error'
14 | })
15 | );
16 |
17 | transports.push(
18 | new logger.transports.File({
19 | filename: 'logs/' + dateStr + '-info.log',
20 | level: 'info'
21 | })
22 | );
23 | }
24 |
25 | if (config.toggle.log.console) {
26 | transports.push(new logger.transports.Console());
27 | }
28 |
29 | logger.configure({
30 | transports: transports
31 | });
32 |
33 | /**
34 | * @param serviceName
35 | */
36 | export const log = function (
37 | level,
38 | payload,
39 | span = undefined,
40 | tagObj = undefined
41 | ) {
42 | if (span && tagObj) {
43 | for (let tag in tagObj) {
44 | if (Object.prototype.hasOwnProperty.call(tagObj, tag)) {
45 | span.setTag(tag, tagObj[tag]);
46 | }
47 | }
48 | }
49 |
50 | if (span && level === 'error') {
51 | span.setTag(Tags.ERROR, true);
52 | }
53 |
54 | logger.log(level, JSON.stringify(payload));
55 |
56 | if (span) {
57 | span.log(payload);
58 | }
59 | };
60 |
--------------------------------------------------------------------------------
/dist/app/controllers/metrics.server.controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const client = require('prom-client');
4 | const collectDefaultMetrics = client.collectDefaultMetrics;
5 | const register = new client.Registry();
6 | collectDefaultMetrics({
7 | timeout: 5000,
8 | register: register
9 | });
10 | const testCounter = new client.Counter({
11 | name: 'counterName',
12 | help: 'counterHelp',
13 | labelNames: ['label1', 'label2'],
14 | registers: [register]
15 | });
16 | const testGauge = new client.Gauge({
17 | name: 'gaugeName',
18 | help: 'gaugeHelp',
19 | registers: [register]
20 | });
21 | const testHistogram = new client.Histogram({
22 | name: 'histogramName',
23 | help: 'histogramHelp',
24 | labelNames: ['label1'],
25 | buckets: [0.1, 5, 15, 50, 100, 500]
26 | });
27 | const testSummary = new client.Summary({
28 | name: 'summaryName',
29 | help: 'summaryHelp'
30 | });
31 | const initCounters = function () {
32 | testCounter.inc({
33 | label1: 'Test Label'
34 | }, 0);
35 | testGauge.set(0);
36 | testHistogram.reset();
37 | testSummary.reset();
38 | };
39 | initCounters();
40 | const mergedRegistries = client.Registry.merge([register, client.register]);
41 | exports.getMetrics = function (req, res) {
42 | res.set('Content-Type', mergedRegistries.contentType);
43 | res.end(mergedRegistries.metrics());
44 | };
45 | //# sourceMappingURL=metrics.server.controller.js.map
--------------------------------------------------------------------------------
/dist/app/controllers/metrics.server.controller.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"metrics.server.controller.js","sourceRoot":"","sources":["../../../src/app/controllers/metrics.server.controller.ts"],"names":[],"mappings":";;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAEtC,MAAM,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAC3D,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;AAOvC,qBAAqB,CAAC;IAClB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,QAAQ;CACrB,CAAC,CAAC;AAMH,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;IACnC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;IACnB,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAChC,SAAS,EAAE,CAAC,QAAQ,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC;IAC/B,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,WAAW;IACjB,SAAS,EAAE,CAAC,QAAQ,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC;IACvC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,UAAU,EAAE,CAAC,QAAQ,CAAC;IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;IACnC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,aAAa;CACtB,CAAC,CAAC;AAKH,MAAM,YAAY,GAAG;IACjB,WAAW,CAAC,GAAG,CACX;QACI,MAAM,EAAE,YAAY;KACvB,EACD,CAAC,CACJ,CAAC;IAEF,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEjB,aAAa,CAAC,KAAK,EAAE,CAAC;IAEtB,WAAW,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC,CAAC;AAEF,YAAY,EAAE,CAAC;AAEf,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE/D,QAAA,UAAU,GAAG,UAAU,GAAG,EAAE,GAAG;IACxC,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACtD,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/app/utils/tracing.utils.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"tracing.utils.js","sourceRoot":"","sources":["../../../src/app/utils/tracing.utils.ts"],"names":[],"mappings":";;AAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,UAAU,CAAC;AAC7D,MAAM,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC9C,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACvD,+CAAoC;AAKvB,QAAA,UAAU,GAAG,UACtB,WAAW,EACX,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,EAC9B,OAAO,GAAG,EAAE;IAEZ,MAAM,YAAY,GAAG;QACjB,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE;YACN,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;YAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;YAC7B,QAAQ,EAAE,IAAI;SACjB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,GAAG;SACb;KACJ,CAAC;IAEF,MAAM,OAAO,GAAG;QACZ,MAAM,EAAE;YACJ,IAAI,CAAC,GAAG;gBACJ,iBAAG,CAAC,MAAM,EAAE;oBACR,OAAO,EAAE,GAAG;iBACf,CAAC,CAAC;YACP,CAAC;YACD,KAAK,CAAC,GAAG;gBACL,iBAAG,CAAC,OAAO,EAAE;oBACT,OAAO,EAAE,GAAG;iBACf,CAAC,CAAC;YACP,CAAC;SACJ;KACJ,CAAC;IAEF,MAAM,CAAC,QAAQ,CAAC,GAAG,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAE3D,IAAI,UAAU,CAAC;IAEf,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACnC,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;KACxD;SAAM;QACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAC9C,mBAAmB,EACnB,OAAO,CACV,CAAC;QAEF,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE;YACjD,OAAO,EAAE,iBAAiB;SAC7B,CAAC,CAAC;KACN;IAED,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AAEW,QAAA,SAAS,GAAG,UAAU,GAAG,EAAE,OAAO,GAAG,EAAE;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;QACnB,MAAM,CAAC,QAAQ,CAAC,GAAG,kBAAU,CAAC,aAAa,CAAC,CAAC;KAChD;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/app/controllers/auth.server.controller.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"auth.server.controller.js","sourceRoot":"","sources":["../../../src/app/controllers/auth.server.controller.ts"],"names":[],"mappings":";;AAAA,IAAI,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC5C,sDAA2C;AAE3C,oDAAyD;AAK5C,QAAA,YAAY,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;IAChD,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,MAAM,CAAC,aAAa,EAAE;QACpD,IAAI,EAAE,CAAC;KACV;SAAM;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;YACzB,OAAO,EACH,kEAAkE;SACzE,CAAC,CAAC;KACN;AACL,CAAC,CAAC;AAQW,QAAA,YAAY,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;IAChD,IAAI,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;IAEtC,IAAI,OAAO,GAAG,sBAAS,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEnC,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACxB,OAAO,EAAE,+CAA+C;SAC3D,CAAC,CAAC;KACN;IAID,IAAI,WAAW,GAAG,IAAI,CAAC;IAGvB,iBAAG,CAAC,MAAM,EAAE;QACR,OAAO,EAAE,iBAAiB;QAC1B,OAAO,EAAE,OAAO;KACnB,CAAC,CAAC;IAEH,IAAI,WAAW,EAAE;QACb,IAAI,EAAE,CAAC;KACV;SAAM;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACxB,OAAO,EAAE,iBAAiB;SAC7B,CAAC,CAAC;KACN;AACL,CAAC,CAAC;AAQW,QAAA,aAAa,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;IACjD,IAAI,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IAIhC,IAAI,WAAW,GAAG,IAAI,CAAC;IAEvB,IAAI,WAAW,IAAI,MAAM,EAAE;QACvB,IAAI,EAAE,CAAC;KACV;SAAM;QACH,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACxB,OAAO,EAAE,iBAAiB;SAC7B,CAAC,CAAC;KACN;AACL,CAAC,CAAC;AAOW,QAAA,sBAAsB,GAAG,UAAU,GAAG,EAAE,GAAG;IAGpD,IAAI,WAAW,GAAG,IAAI,CAAC;IAEvB,IAAI,WAAW,EAAE;QACb,IAAI,KAAK,GAAG,oBAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAKlC,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;YACzB,KAAK,EAAE,KAAK;SACf,CAAC,CAAC;KACN;IAED,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;QACzB,KAAK,EAAE,mCAAmC;KAC7C,CAAC,CAAC;AACP,CAAC,CAAC"}
--------------------------------------------------------------------------------
/src/app/utils/api.utils.ts:
--------------------------------------------------------------------------------
1 | const axios = require('axios');
2 | import { log } from './error.utils';
3 | const { FORMAT_HTTP_HEADERS } = require('opentracing');
4 |
5 | /**
6 | * Make an API Call by passing the payload and inject Tracing headers and context in the process
7 | * @param url
8 | * @param payload
9 | * @param auth
10 | * @param span
11 | * @param method
12 | */
13 | export const apiCall = async function (apiOptions, span) {
14 | let apiCallSpan = global['tracer'].startSpan('api-call', { childOf: span });
15 |
16 | try {
17 | apiOptions.headers = apiOptions.headers || {
18 | Accept: 'application/json;charset=UTF-8'
19 | };
20 |
21 | apiOptions.responseType = apiOptions.responseType || 'json';
22 |
23 | apiOptions.method = apiOptions.method || 'POST';
24 |
25 | global['tracer'].inject(
26 | apiCallSpan,
27 | FORMAT_HTTP_HEADERS,
28 | apiOptions.headers
29 | );
30 |
31 | log('info', {
32 | msg: 'Routing',
33 | url: apiOptions.url
34 | });
35 |
36 | let response = await axios(apiOptions);
37 |
38 | apiCallSpan.finish();
39 |
40 | return {
41 | err: null,
42 | response: response.data,
43 | span: apiCallSpan
44 | };
45 | } catch (err) {
46 | log(
47 | 'error',
48 | {
49 | message: 'Error in routing url',
50 | url: apiOptions.url,
51 | err: err
52 | },
53 | apiCallSpan
54 | );
55 |
56 | apiCallSpan.finish();
57 |
58 | return {
59 | err: err,
60 | response: null,
61 | span: apiCallSpan
62 | };
63 | }
64 | };
65 |
--------------------------------------------------------------------------------
/src/app/controllers/metrics.server.controller.ts:
--------------------------------------------------------------------------------
1 | // let config = require('../../config/config');
2 | const client = require('prom-client');
3 |
4 | const collectDefaultMetrics = client.collectDefaultMetrics;
5 | const register = new client.Registry();
6 |
7 | /**
8 | * COLLECT DEFAULT METRICS FOR THE PROCESS
9 | * https://prometheus.io/docs/instrumenting/writing_clientlibs/#standard-and-runtime-collectors
10 | */
11 |
12 | collectDefaultMetrics({
13 | timeout: 5000,
14 | register: register
15 | });
16 |
17 | /**
18 | * METRIC DEFINITIONS
19 | */
20 |
21 | const testCounter = new client.Counter({
22 | name: 'counterName',
23 | help: 'counterHelp',
24 | labelNames: ['label1', 'label2'],
25 | registers: [register]
26 | });
27 |
28 | const testGauge = new client.Gauge({
29 | name: 'gaugeName',
30 | help: 'gaugeHelp',
31 | registers: [register]
32 | });
33 |
34 | const testHistogram = new client.Histogram({
35 | name: 'histogramName',
36 | help: 'histogramHelp',
37 | labelNames: ['label1'],
38 | buckets: [0.1, 5, 15, 50, 100, 500]
39 | });
40 |
41 | const testSummary = new client.Summary({
42 | name: 'summaryName',
43 | help: 'summaryHelp'
44 | });
45 |
46 | /**
47 | * INITIALIZE METRICS
48 | */
49 | const initCounters = function () {
50 | testCounter.inc(
51 | {
52 | label1: 'Test Label'
53 | },
54 | 0
55 | );
56 |
57 | testGauge.set(0);
58 |
59 | testHistogram.reset();
60 |
61 | testSummary.reset();
62 | };
63 |
64 | initCounters();
65 |
66 | const mergedRegistries = client.Registry.merge([register, client.register]);
67 |
68 | export const getMetrics = function (req, res) {
69 | res.set('Content-Type', mergedRegistries.contentType);
70 | res.end(mergedRegistries.metrics());
71 | };
72 |
--------------------------------------------------------------------------------
/dist/app/utils/tracing.utils.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | const initJaegerTracer = require('jaeger-client').initTracer;
4 | const config = require('../../config/config');
5 | const { FORMAT_HTTP_HEADERS } = require('opentracing');
6 | const error_utils_1 = require("./error.utils");
7 | exports.initTracer = function (serviceName, projectName = config.app.title, headers = {}) {
8 | const tracerConfig = {
9 | serviceName: serviceName,
10 | reporter: {
11 | agentHost: config.jaeger.host,
12 | agentPort: config.jaeger.port,
13 | logSpans: true
14 | },
15 | sampler: {
16 | type: 'probabilistic',
17 | param: 1.0
18 | }
19 | };
20 | const options = {
21 | logger: {
22 | info(msg) {
23 | error_utils_1.log('info', {
24 | payload: msg
25 | });
26 | },
27 | error(msg) {
28 | error_utils_1.log('error', {
29 | payload: msg
30 | });
31 | }
32 | }
33 | };
34 | global['tracer'] = initJaegerTracer(tracerConfig, options);
35 | let parentSpan;
36 | if (Object.keys(headers).length === 0) {
37 | parentSpan = global['tracer'].startSpan(projectName);
38 | }
39 | else {
40 | const parentSpanContext = global['tracer'].extract(FORMAT_HTTP_HEADERS, headers);
41 | parentSpan = global['tracer'].startSpan(projectName, {
42 | childOf: parentSpanContext
43 | });
44 | }
45 | return parentSpan;
46 | };
47 | exports.startSpan = function (tag, options = {}) {
48 | if (!global['tracer']) {
49 | global['tracer'] = exports.initTracer('ml-platform');
50 | }
51 | return global['tracer'].startSpan(tag, options);
52 | };
53 | //# sourceMappingURL=tracing.utils.js.map
--------------------------------------------------------------------------------
/src/app/utils/tracing.utils.ts:
--------------------------------------------------------------------------------
1 | const initJaegerTracer = require('jaeger-client').initTracer;
2 | const config = require('../../config/config');
3 | const { FORMAT_HTTP_HEADERS } = require('opentracing');
4 | import { log } from './error.utils';
5 |
6 | /**
7 | * @param serviceName
8 | */
9 | export const initTracer = function (
10 | serviceName,
11 | projectName = config.app.title,
12 | headers = {}
13 | ) {
14 | const tracerConfig = {
15 | serviceName: serviceName,
16 | reporter: {
17 | agentHost: config.jaeger.host,
18 | agentPort: config.jaeger.port,
19 | logSpans: true
20 | },
21 | sampler: {
22 | type: 'probabilistic',
23 | param: 1.0
24 | }
25 | };
26 |
27 | const options = {
28 | logger: {
29 | info(msg) {
30 | log('info', {
31 | payload: msg
32 | });
33 | },
34 | error(msg) {
35 | log('error', {
36 | payload: msg
37 | });
38 | }
39 | }
40 | };
41 |
42 | global['tracer'] = initJaegerTracer(tracerConfig, options);
43 |
44 | let parentSpan;
45 |
46 | if (Object.keys(headers).length === 0) {
47 | parentSpan = global['tracer'].startSpan(projectName);
48 | } else {
49 | const parentSpanContext = global['tracer'].extract(
50 | FORMAT_HTTP_HEADERS,
51 | headers
52 | );
53 |
54 | parentSpan = global['tracer'].startSpan(projectName, {
55 | childOf: parentSpanContext
56 | });
57 | }
58 |
59 | return parentSpan;
60 | };
61 |
62 | export const startSpan = function (tag, options = {}) {
63 | if (!global['tracer']) {
64 | global['tracer'] = initTracer('ml-platform');
65 | }
66 | return global['tracer'].startSpan(tag, options);
67 | };
68 |
--------------------------------------------------------------------------------
/src/app/utils/auth.utils.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const path = require('path'),
4 | fs = require('fs');
5 |
6 | const jwt = require('jsonwebtoken');
7 |
8 | let config = require('../../config/config');
9 |
10 | let privateKEY = fs.readFileSync(
11 | path.join(__dirname, '../../../creds/jwtRS512.key'),
12 | 'utf8'
13 | ),
14 | publicKEY = fs.readFileSync(
15 | path.join(__dirname, '../../../creds/jwtRS512.key.pub'),
16 | 'utf8'
17 | );
18 |
19 | export const signJWT = function (payload, $Options) {
20 | /*
21 | sOptions = {
22 | issuer: "Authorizaxtion/Resource/This server",
23 | subject: "username@example.com",
24 | audience: "Client_Identity" // this should be provided by client
25 | }
26 | */
27 | // Token signing options
28 | let signOptions = {
29 | issuer: $Options.issuer || config.jwt.issuer,
30 | expiresIn: '30d', // 30 days validity
31 | algorithm: 'RS512',
32 | subject: $Options.subject || undefined,
33 | audience: $Options.audience || undefined
34 | };
35 |
36 | return jwt.sign(payload, privateKEY, signOptions);
37 | };
38 |
39 | export const verifyJWT = function (token, $Options) {
40 | /*
41 | vOption = {
42 | issuer: "Authorization/Resource/This server",
43 | subject: "username@example.com",
44 | audience: "Client_Identity" // this should be provided by client
45 | }
46 | */
47 | let verifyOptions = {
48 | issuer: $Options.issuer || config.jwt.issuer,
49 | subject: $Options.subject || undefined,
50 | audience: $Options.audience || undefined,
51 | expiresIn: '30d',
52 | algorithm: ['RS512']
53 | };
54 |
55 | try {
56 | return jwt.verify(token, publicKEY, verifyOptions);
57 | } catch (err) {
58 | return false;
59 | }
60 | };
61 |
62 | export const decodeJWT = function (token) {
63 | return jwt.decode(token, { complete: true });
64 | // returns null if token is invalid
65 | };
66 |
--------------------------------------------------------------------------------
/dist/app/controllers/auth.server.controller.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | let config = require('../../config/config');
4 | const error_utils_1 = require("../utils/error.utils");
5 | const auth_utils_1 = require("../utils/auth.utils");
6 | exports.authenticate = function (req, res, next) {
7 | if (req.headers.authorization === config.authorization) {
8 | next();
9 | }
10 | else {
11 | return res.status(400).jsonp({
12 | message: 'You may be unauthorized to do this request! Please add the token'
13 | });
14 | }
15 | };
16 | exports.resolveToken = function (req, res, next) {
17 | let token = req.headers.authorization;
18 | let decoded = auth_utils_1.verifyJWT(token, {});
19 | if (!decoded) {
20 | return res.status(401).send({
21 | message: 'Invalid access. Sign in / validate your token'
22 | });
23 | }
24 | let shouldAllow = true;
25 | error_utils_1.log('info', {
26 | message: 'Resolving token',
27 | decoded: decoded
28 | });
29 | if (shouldAllow) {
30 | next();
31 | }
32 | else {
33 | return res.status(401).send({
34 | message: 'Invalid access.'
35 | });
36 | }
37 | };
38 | exports.resolveSecret = function (req, res, next) {
39 | let secret = req.headers.secret;
40 | let shouldAllow = true;
41 | if (shouldAllow && secret) {
42 | next();
43 | }
44 | else {
45 | return res.status(401).send({
46 | message: 'Invalid access.'
47 | });
48 | }
49 | };
50 | exports.generateAPICredentials = function (req, res) {
51 | let shouldAllow = true;
52 | if (shouldAllow) {
53 | let token = auth_utils_1.signJWT(req.body, {});
54 | return res.status(200).jsonp({
55 | token: token
56 | });
57 | }
58 | return res.status(500).jsonp({
59 | error: 'Cannot read end point credentials'
60 | });
61 | };
62 | //# sourceMappingURL=auth.server.controller.js.map
--------------------------------------------------------------------------------
/dist/app/utils/api.utils.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4 | return new (P || (P = Promise))(function (resolve, reject) {
5 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8 | step((generator = generator.apply(thisArg, _arguments || [])).next());
9 | });
10 | };
11 | Object.defineProperty(exports, "__esModule", { value: true });
12 | const axios = require('axios');
13 | const error_utils_1 = require("./error.utils");
14 | const { FORMAT_HTTP_HEADERS } = require('opentracing');
15 | exports.apiCall = function (apiOptions, span) {
16 | return __awaiter(this, void 0, void 0, function* () {
17 | let apiCallSpan = global['tracer'].startSpan('api-call', { childOf: span });
18 | try {
19 | apiOptions.headers = apiOptions.headers || {
20 | Accept: 'application/json;charset=UTF-8'
21 | };
22 | apiOptions.responseType = apiOptions.responseType || 'json';
23 | apiOptions.method = apiOptions.method || 'POST';
24 | global['tracer'].inject(apiCallSpan, FORMAT_HTTP_HEADERS, apiOptions.headers);
25 | error_utils_1.log('info', {
26 | msg: 'Routing',
27 | url: apiOptions.url
28 | });
29 | let response = yield axios(apiOptions);
30 | apiCallSpan.finish();
31 | return {
32 | err: null,
33 | response: response.data,
34 | span: apiCallSpan
35 | };
36 | }
37 | catch (err) {
38 | error_utils_1.log('error', {
39 | message: 'Error in routing url',
40 | url: apiOptions.url,
41 | err: err
42 | }, apiCallSpan);
43 | apiCallSpan.finish();
44 | return {
45 | err: err,
46 | response: null,
47 | span: apiCallSpan
48 | };
49 | }
50 | });
51 | };
52 | //# sourceMappingURL=api.utils.js.map
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible Node.js debug attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "type": "node",
9 | "request": "launch",
10 | "name": "Launch Program",
11 | "program": "${workspaceFolder}/src/index.ts",
12 | "outFiles": [
13 | "${workspaceFolder}/dist/**/*.js"
14 | ],
15 | "env": {
16 | "NODE_ENV": "development"
17 | }
18 | },
19 | {
20 | "type": "node",
21 | "request": "launch",
22 | "name": "Launch in Docker",
23 | "preLaunchTask": "tsc-watch",
24 | "protocol": "auto",
25 | "runtimeExecutable": "npm",
26 | "runtimeArgs": [
27 | "run-script",
28 | "docker-debug"
29 | ],
30 | "port": 9229,
31 | "restart": true,
32 | "timeout": 60000,
33 | "localRoot": "${workspaceFolder}",
34 | "remoteRoot": "/app/server",
35 | "outFiles": [
36 | "${workspaceFolder}/dist/**/*.js"
37 | ],
38 | "console": "integratedTerminal",
39 | "internalConsoleOptions": "neverOpen"
40 | },
41 | {
42 | "type": "node",
43 | "request": "attach",
44 | "name": "Attach to Docker",
45 | "preLaunchTask": "tsc-watch",
46 | "protocol": "auto",
47 | "port": 9229,
48 | "restart": true,
49 | "localRoot": "${workspaceFolder}",
50 | "remoteRoot": "/app/server",
51 | "outFiles": [
52 | "${workspaceFolder}/dist/**/*.js"
53 | ]
54 | },
55 | {
56 | "type": "node",
57 | "request": "launch",
58 | "name": "Local Nodemon",
59 | "preLaunchTask": "tsc-watch",
60 | "protocol": "auto",
61 | "runtimeExecutable": "npm",
62 | "runtimeArgs": [
63 | "run",
64 | "debug"
65 | ],
66 | "restart": true,
67 | "port": 9229,
68 | "console": "integratedTerminal",
69 | "internalConsoleOptions": "neverOpen",
70 | "outFiles": [
71 | "${workspaceFolder}/dist/**/*.js"
72 | ]
73 | }
74 | ]
75 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-skeleton",
3 | "version": "1.0.0",
4 | "description": "Node Skeleton",
5 | "main": "dist/server.js",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/tvvignesh/node-skeleton.git"
9 | },
10 | "scripts": {
11 | "build": "npx tsc && npx copyfiles -u 1 -e \"src/**/*.ts\" \"src/**/*.*\" dist/",
12 | "watch": "tsc -w -p ./",
13 | "debug": "npx cross-env NODE_ENV=development nodemon --nolazy ./dist/server.js",
14 | "docker-debug": "npm run build && docker-compose up",
15 | "lint": "npx eslint --ext=.ts .",
16 | "test": "npx tsc && ava ./dist/tests",
17 | "document": "npx typedoc",
18 | "format": "prettier --write '**/*.{ts,js,css,md}'",
19 | "start": "node ./dist/server.js",
20 | "start-dev": "npm run format && npm run lint && npx cross-env NODE_ENV=development nodemon ./dist/server.js",
21 | "start-alpha": "npm run build && npm run lint && npx cross-env NODE_ENV=alpha node ./dist/server.js",
22 | "start-secure": "npm run build && npm run lint && npx cross-env NODE_ENV=secure node ./dist/server.js"
23 | },
24 | "author": "Vignesh T.V.",
25 | "license": "MIT",
26 | "dependencies": {
27 | "axios": "^0.21.1",
28 | "body-parser": "^1.19.0",
29 | "cross-env": "^7.0.2",
30 | "dotenv": "^8.2.0",
31 | "express": "^4.17.1",
32 | "glob": "^7.1.6",
33 | "helmet": "^3.22.0",
34 | "jaeger-client": "^3.17.2",
35 | "jsonwebtoken": "^8.5.1",
36 | "method-override": "^3.0.0",
37 | "mustache-express": "^1.3.0",
38 | "opentracing": "^0.14.4",
39 | "passport": "^0.4.1",
40 | "prom-client": "^12.0.0",
41 | "swagger-ui-express": "^4.1.4",
42 | "winston": "^3.2.1",
43 | "xss-clean": "^0.1.1",
44 | "yamljs": "^0.3.0"
45 | },
46 | "devDependencies": {
47 | "@types/body-parser": "^1.19.0",
48 | "@types/express": "^4.17.6",
49 | "@types/express-serve-static-core": "^4.17.4",
50 | "@types/node": "^13.11.1",
51 | "@typescript-eslint/eslint-plugin": "^2.27.0",
52 | "@typescript-eslint/parser": "^2.27.0",
53 | "acorn": "^7.1.1",
54 | "ava": "3.6.0",
55 | "copyfiles": "^2.2.0",
56 | "eslint": "^6.8.0",
57 | "eslint-config-google": "^0.14.0",
58 | "eslint-config-prettier": "^6.10.1",
59 | "eslint-plugin-prettier": "^3.1.2",
60 | "morgan": "^1.10.0",
61 | "nodemon": "^2.0.3",
62 | "prettier": "^2.0.4",
63 | "typedoc": "^0.17.4",
64 | "typescript": "^3.8.3"
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/app/controllers/auth.server.controller.ts:
--------------------------------------------------------------------------------
1 | let config = require('../../config/config');
2 | import { log } from '../utils/error.utils';
3 |
4 | import { signJWT, verifyJWT } from '../utils/auth.utils';
5 |
6 | /**
7 | * AUTHENTICATION MIDDLEWARE FUNCTION
8 | */
9 | export const authenticate = function (req, res, next) {
10 | if (req.headers.authorization === config.authorization) {
11 | next();
12 | } else {
13 | return res.status(400).jsonp({
14 | message:
15 | 'You may be unauthorized to do this request! Please add the token'
16 | });
17 | }
18 | };
19 |
20 | /**
21 | * Resolve JWT Token Middleware to find the User info
22 | * @param req
23 | * @param res
24 | * @param next
25 | */
26 | export const resolveToken = function (req, res, next) {
27 | let token = req.headers.authorization;
28 |
29 | let decoded = verifyJWT(token, {});
30 |
31 | if (!decoded) {
32 | return res.status(401).send({
33 | message: 'Invalid access. Sign in / validate your token'
34 | });
35 | }
36 |
37 | // Use the decoded object (retrieved from JWT) to fetch the user from the DB
38 |
39 | let shouldAllow = true;
40 |
41 | // Remove this console once this portion is modified
42 | log('info', {
43 | message: 'Resolving token',
44 | decoded: decoded
45 | });
46 |
47 | if (shouldAllow) {
48 | next();
49 | } else {
50 | return res.status(401).send({
51 | message: 'Invalid access.'
52 | });
53 | }
54 | };
55 |
56 | /**
57 | * Resolve JWT Secret to identify access rights
58 | * @param req
59 | * @param res
60 | * @param next
61 | */
62 | export const resolveSecret = function (req, res, next) {
63 | let secret = req.headers.secret;
64 |
65 | // Modify this to add your own verification from the DB. If success, allow
66 |
67 | let shouldAllow = true;
68 |
69 | if (shouldAllow && secret) {
70 | next();
71 | } else {
72 | return res.status(401).send({
73 | message: 'Invalid access.'
74 | });
75 | }
76 | };
77 |
78 | /**
79 | * Generate JWT API Credentials after signing - Token & Secret
80 | * @param req
81 | * @param res
82 | */
83 | export const generateAPICredentials = function (req, res) {
84 | // When generating do a check to see if the user is allowed to have access to the API
85 |
86 | let shouldAllow = true;
87 |
88 | if (shouldAllow) {
89 | let token = signJWT(req.body, {});
90 |
91 | // Secret generation should be done for every tenant
92 | // Once generated, secret can be stored/retrieved from DB
93 |
94 | return res.status(200).jsonp({
95 | token: token
96 | });
97 | }
98 |
99 | return res.status(500).jsonp({
100 | error: 'Cannot read end point credentials'
101 | });
102 | };
103 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6 |
7 | ## Our Standards
8 |
9 | Examples of behavior that contributes to creating a positive environment include:
10 |
11 | - Using welcoming and inclusive language
12 | - Being respectful of differing viewpoints and experiences
13 | - Gracefully accepting constructive criticism
14 | - Focusing on what is best for the community
15 | - Showing empathy towards other community members
16 |
17 | Examples of unacceptable behavior by participants include:
18 |
19 | - The use of sexualized language or imagery and unwelcome sexual attention or advances
20 | - Trolling, insulting/derogatory comments, and personal or political attacks
21 | - Public or private harassment
22 | - Publishing others' private information, such as a physical or electronic address, without explicit permission
23 | - Other conduct which could reasonably be considered inappropriate in a professional setting
24 |
25 | ## Our Responsibilities
26 |
27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28 |
29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30 |
31 | ## Scope
32 |
33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34 |
35 | ## Enforcement
36 |
37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at vigneshviswam@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38 |
39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40 |
41 | ## Attribution
42 |
43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44 |
45 | [homepage]: http://contributor-covenant.org
46 | [version]: http://contributor-covenant.org/version/1/4/
47 |
--------------------------------------------------------------------------------
/dist/config/express.js.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"express.js","sourceRoot":"","sources":["../../src/config/express.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAMb,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAClB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,EACtB,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,EACxB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3B,IAAI,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,EAC5B,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,EACnC,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,EAC3C,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,EAC1B,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,EAC7C,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,EAC1B,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,EACzC,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,EACxB,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE3B,6CAA0C;AAC1C,0DAA+C;AAM/C,MAAM,CAAC,OAAO,GAAG;IAEb,IAAI,GAAG,GAAG,OAAO,EAAE,CAAC;IAGpB,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,eAAM,CAAC,GAAG,CAAC,KAAK,CAAC;IACpC,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,eAAM,CAAC,GAAG,CAAC,WAAW,CAAC;IAGhD,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC5B,IAAI,eAAM,CAAC,GAAG,CAAC,GAAG,EAAE;YAChB,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,eAAM,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,eAAM,CAAC,IAAI,CAAC;SACvD;aAAM;YACH,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,QAAQ,GAAG,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC;SACtE;QACD,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;IAGH,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAGhC,GAAG,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,EAAE,CAAC,CAAC;IAClD,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;IAC3C,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;IAGxD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QACxC,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE/B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAGvB,GAAG,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;KAChC;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAC9C,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;KAC/B;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE;QACzC,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAC;KAC/B;SAAM,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE;QAC1C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1B;IAGD,GAAG,CAAC,GAAG,CACH,UAAU,CAAC,UAAU,CAAC;QAClB,QAAQ,EAAE,IAAI;KACjB,CAAC,CACL,CAAC;IACF,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACf,GAAG,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IAI1B,GAAG,CAAC,GAAG,CACH,MAAM,CAAC;QACH,UAAU,EAAE,KAAK;KACpB,CAAC,CACL,CAAC;IACF,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1B,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3B,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5B,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,GAAG,EAAE,IAAI;QAC5B,GAAG,CAAC,MAAM,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC;QAC/C,GAAG,CAAC,MAAM,CACN,8BAA8B,EAC9B,gDAAgD,CACnD,CAAC;QACF,GAAG,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QACpC,IAAI,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAEhC,IAAI,eAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QACtB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAC5C,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC;KAC3E;IAGD,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,UAAU,SAAS;QACxD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAOH,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAG/D,GAAG,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,GAAG;QACtB,iBAAG,CAAC,OAAO,EAAE;YACT,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAAC,GAAG;YACtC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK;SACjC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,EAAE;YACvD,IAAI,EAAE;gBACF,KAAK,EAAE,gBAAgB;aAC1B;YACD,OAAO,EAAE;gBACL,KAAK,EAAE,OAAO;gBACd,WAAW,EAAE,iCAAiC;aACjD;SACJ,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC;IAEX,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE;QAEnC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAG7C,IAAI,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC;QACtE,IAAI,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;QAGxE,MAAM,GAAG,KAAK,CAAC,YAAY,CACvB;YACI,GAAG,EAAE,UAAU;YACf,IAAI,EAAE,WAAW;SACpB,EACD,GAAG,CACN,CAAC;KACL;SAAM;QACH,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;KACnC;IAED,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAG1B,OAAO,GAAG,CAAC;AACf,CAAC,CAAC"}
--------------------------------------------------------------------------------
/dist/config/express.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | Object.defineProperty(exports, "__esModule", { value: true });
3 | let fs = require('fs'), http = require('http'), https = require('https'), path = require('path');
4 | let express = require('express'), bodyParser = require('body-parser'), methodOverride = require('method-override'), helmet = require('helmet'), mustacheExpress = require('mustache-express'), xss = require('xss-clean'), swaggerUi = require('swagger-ui-express'), YAML = require('yamljs'), glob = require('glob');
5 | const config_1 = require("../config/config");
6 | const error_utils_1 = require("../app/utils/error.utils");
7 | module.exports = function () {
8 | let app = express();
9 | app.locals.title = config_1.config.app.title;
10 | app.locals.description = config_1.config.app.description;
11 | app.use(function (req, res, next) {
12 | if (config_1.config.app.url) {
13 | app.locals.url = config_1.config.app.url + ':' + config_1.config.port;
14 | }
15 | else {
16 | res.locals.url = req.protocol + '://' + req.headers.host + req.url;
17 | }
18 | next();
19 | });
20 | app.set('showStackError', true);
21 | app.engine('server.view.html', mustacheExpress());
22 | app.set('view engine', 'server.view.html');
23 | app.set('views', path.join(__dirname, '../app/views/'));
24 | if (process.env.NODE_ENV === 'development') {
25 | let morgan = require('morgan');
26 | app.use(morgan('dev'));
27 | app.set('view cache', false);
28 | }
29 | else if (process.env.NODE_ENV === 'production') {
30 | app.locals.cache = 'memory';
31 | }
32 | else if (process.env.NODE_ENV === 'alpha') {
33 | app.locals.cache = 'memory';
34 | }
35 | else if (process.env.NODE_ENV === 'secure') {
36 | let morgan = require('morgan');
37 | app.use(morgan('dev'));
38 | }
39 | app.use(bodyParser.urlencoded({
40 | extended: true
41 | }));
42 | app.use(bodyParser.json());
43 | app.use(xss());
44 | app.use(methodOverride());
45 | app.use(helmet({
46 | frameguard: false
47 | }));
48 | app.use(helmet.xssFilter());
49 | app.use(helmet.noSniff());
50 | app.use(helmet.ieNoOpen());
51 | app.disable('x-powered-by');
52 | app.use(function (req, res, next) {
53 | res.header('Access-Control-Allow-Origin', '*');
54 | res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
55 | res.removeHeader('X-Frame-Options');
56 | next();
57 | });
58 | app.set('jsonp callback', true);
59 | if (config_1.config.toggle.apidoc) {
60 | const swaggerDocument = YAML.load(path.join(__dirname, '../../apidoc.yaml'));
61 | app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
62 | }
63 | glob.sync('./**/routes/**/*.js').forEach(function (routePath) {
64 | require(path.resolve(routePath))(app);
65 | });
66 | app.use(express.static(path.join(__dirname, '../app/public')));
67 | app.use(function (req, res) {
68 | error_utils_1.log('error', {
69 | message: 'Page Not Found - ' + req.url,
70 | payload: req.body || req.query
71 | });
72 | res.render(path.join(__dirname, '../app/views/error/404'), {
73 | head: {
74 | title: 'Page Not Found'
75 | },
76 | content: {
77 | title: 'OOPS!',
78 | description: 'Page Not Found. Error Code: 404'
79 | }
80 | });
81 | });
82 | let server;
83 | if (process.env.NODE_ENV === 'secure') {
84 | console.log('Securely using https protocol');
85 | let privateKey = fs.readFileSync('./config/sslcerts/key.pem', 'utf8');
86 | let certificate = fs.readFileSync('./config/sslcerts/cert.pem', 'utf8');
87 | server = https.createServer({
88 | key: privateKey,
89 | cert: certificate
90 | }, app);
91 | }
92 | else {
93 | server = http.createServer(app);
94 | }
95 | app.set('server', server);
96 | return app;
97 | };
98 | //# sourceMappingURL=express.js.map
--------------------------------------------------------------------------------
/src/config/express.ts:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | /**
4 | * Module dependencies.
5 | */
6 |
7 | let fs = require('fs'),
8 | http = require('http'),
9 | https = require('https'),
10 | path = require('path');
11 |
12 | let express = require('express'),
13 | bodyParser = require('body-parser'),
14 | methodOverride = require('method-override'),
15 | helmet = require('helmet'),
16 | mustacheExpress = require('mustache-express'),
17 | xss = require('xss-clean'),
18 | swaggerUi = require('swagger-ui-express'),
19 | YAML = require('yamljs'),
20 | glob = require('glob');
21 |
22 | import { config } from '../config/config';
23 | import { log } from '../app/utils/error.utils';
24 |
25 | // let schema = require('../schema/schema').schema;
26 |
27 | // import {schema as schema} from '../schema/schema';
28 |
29 | module.exports = function () {
30 | // Initialize express app
31 | let app = express();
32 |
33 | // Setting application local variables
34 | app.locals.title = config.app.title;
35 | app.locals.description = config.app.description;
36 |
37 | // Passing the request url to environment locals
38 | app.use(function (req, res, next) {
39 | if (config.app.url) {
40 | app.locals.url = config.app.url + ':' + config.port;
41 | } else {
42 | res.locals.url = req.protocol + '://' + req.headers.host + req.url;
43 | }
44 | next();
45 | });
46 |
47 | // Showing stack errors
48 | app.set('showStackError', true);
49 |
50 | // Config View Engine
51 | app.engine('server.view.html', mustacheExpress());
52 | app.set('view engine', 'server.view.html');
53 | app.set('views', path.join(__dirname, '../app/views/'));
54 |
55 | // Environment dependent middleware
56 | if (process.env.NODE_ENV === 'development') {
57 | let morgan = require('morgan');
58 | // Enable logger (morgan)
59 | app.use(morgan('dev'));
60 |
61 | // Disable views cache
62 | app.set('view cache', false);
63 | } else if (process.env.NODE_ENV === 'production') {
64 | app.locals.cache = 'memory';
65 | } else if (process.env.NODE_ENV === 'alpha') {
66 | app.locals.cache = 'memory';
67 | } else if (process.env.NODE_ENV === 'secure') {
68 | let morgan = require('morgan');
69 | app.use(morgan('dev'));
70 | }
71 |
72 | // Request body parsing middleware should be above methodOverride
73 | app.use(
74 | bodyParser.urlencoded({
75 | extended: true
76 | })
77 | );
78 | app.use(bodyParser.json());
79 | app.use(xss());
80 | app.use(methodOverride());
81 |
82 | // Use helmet to secure Express headers
83 | // app.use(helmet.frameguard());
84 | app.use(
85 | helmet({
86 | frameguard: false
87 | })
88 | );
89 | app.use(helmet.xssFilter());
90 | app.use(helmet.noSniff());
91 | app.use(helmet.ieNoOpen());
92 | app.disable('x-powered-by');
93 |
94 | app.use(function (req, res, next) {
95 | res.header('Access-Control-Allow-Origin', '*');
96 | res.header(
97 | 'Access-Control-Allow-Headers',
98 | 'Origin, X-Requested-With, Content-Type, Accept'
99 | );
100 | res.removeHeader('X-Frame-Options');
101 | next();
102 | });
103 |
104 | app.set('jsonp callback', true);
105 |
106 | if (config.toggle.apidoc) {
107 | const swaggerDocument = YAML.load(
108 | path.join(__dirname, '../../apidoc.yaml')
109 | );
110 | app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
111 | }
112 |
113 | // Globbing routing files
114 | glob.sync('./**/routes/**/*.js').forEach(function (routePath) {
115 | require(path.resolve(routePath))(app);
116 | });
117 |
118 | // config.getGlobbedFiles('./**/routes/**/*.js').forEach(function(routePath) {
119 | // require(path.resolve(routePath))(app);
120 | // });
121 |
122 | // Config Public Folder for Static Content
123 | app.use(express.static(path.join(__dirname, '../app/public')));
124 |
125 | // Assume 404 since no middleware responded
126 | app.use(function (req, res) {
127 | log('error', {
128 | message: 'Page Not Found - ' + req.url,
129 | payload: req.body || req.query
130 | });
131 | res.render(path.join(__dirname, '../app/views/error/404'), {
132 | head: {
133 | title: 'Page Not Found'
134 | },
135 | content: {
136 | title: 'OOPS!',
137 | description: 'Page Not Found. Error Code: 404'
138 | }
139 | });
140 | });
141 |
142 | let server;
143 |
144 | if (process.env.NODE_ENV === 'secure') {
145 | // Log SSL usage
146 | console.log('Securely using https protocol');
147 |
148 | // Load SSL key and certificate
149 | let privateKey = fs.readFileSync('./config/sslcerts/key.pem', 'utf8');
150 | let certificate = fs.readFileSync('./config/sslcerts/cert.pem', 'utf8');
151 |
152 | // Create HTTPS Server
153 | server = https.createServer(
154 | {
155 | key: privateKey,
156 | cert: certificate
157 | },
158 | app
159 | );
160 | } else {
161 | server = http.createServer(app);
162 | }
163 |
164 | app.set('server', server);
165 |
166 | // Return Express server instance
167 | return app;
168 | };
169 |
170 | export {};
171 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Node Skeleton
2 |
3 | A boilerplate to help start Node.js projects quickly and effectively. Packaged with Typescript, Docker, Kubernetes, PM2, Eslint, Prettier, VSCode config, Winston, Typedoc, Nodemon, AVA, PromClient, JWT, Editorconfig, OpenAPI/Swagger, Jaeger/Open Tracing, etc.
4 |
5 | ## Motive behind this project
6 |
7 | Having worked on a lot of node.js projects, I had to repetitively do the same tasks over and over again, get a project structure, install stuff, implement standardization, containerize it, implement logging, and make sure everything is in place before I start off. This takes all the burden out and lets people focus just on the logic and nothing else.
8 |
9 | You can find the article I wrote on this project here: [https://medium.com/techahoy/building-a-boilerplate-for-microservices-part-1-166ce00f5ce9](https://medium.com/techahoy/building-a-boilerplate-for-microservices-part-1-166ce00f5ce9)
10 |
11 | ## Basic Concepts behind the architecture
12 |
13 | 1. All the code you write resides within `src` folder and gets built when you start the server in `dist` folder.
14 | 2. All configuration is stored against the respective environment in `src/config/env` folder and `.env` file in the root.
15 | 3. All your navigation routes are placed in `src/app/routes` folder. You can place as many js files as you want within.
16 | 4. All your logic is written in controllers placed within `src/app/controllers` folder.
17 | 5. If you have utility functions which you will use across controllers, put them in `src/app/utils` folder.
18 | 6. All the server side rendered template files are to be placed in `src/app/views` folder.
19 | 7. All your static files and content is to be placed in the `public` folder.
20 |
21 | ## Deployment instructions
22 |
23 | ### Normal Installation
24 |
25 | 1. Install node.js and git
26 | 2. Add them to path if not already in path.
27 | 3. Install typescript globally with `npm install typescript -g`
28 | 4. Run npm install to get all the dependencies installed
29 | 5. cd to the project directory and run tsc to build using typescript
30 | 6. Run `npm run-script start-dev`
31 |
32 | ### Cloning & Running with Docker
33 |
34 | 1. Install [Docker](https://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/)
35 | 2. Clone/Download the repository and CD to it
36 | 3. Run `docker-compose up` to get the containers installed and started.
37 | 4. Run `docker-compose -f docker-compose-prod.yml up` to get the containers installed and started in production environment.
38 |
39 | ### Pulling & Running from Docker Hub
40 |
41 | 1. Pull the container from DockerHub with the command `docker pull tvvignesh/node-skeleton` (Add version if you want)
42 |
43 | 2. Then, start the container using the command:
44 | `docker run -d -p 8085:8085 -p 9229:9229 -e NODEJS_PORT=8085 -e NODE_ENV=development -e NODEJS_IP=0.0.0.0 tvvignesh/node-skeleton`
45 |
46 | ### Running via PM2
47 |
48 | 1. Install node.js and [pm2](https://github.com/Unitech/pm2)
49 | 2. CD to the pm2 directory
50 | 3. Run `pm2 start pm2-dev.json` to start the development cluster
51 |
52 | ### Running with Kubernetes
53 |
54 | The project comes with some default kubernetes deployment and service yaml configurations. To use it, do `kubectl apply -f kubernetes/deployment.yaml` and `kubectl apply -f kubernetes/service.yaml` once Kubernetes and Kubectl are installed onto your system and configured.
55 |
56 | ## Building the code
57 |
58 | 1. Run `npm run build` to build the typescript code, copy relevant files
59 |
60 | ## Logging Middleware
61 |
62 | Logs can be added by using the log function from error.utils by specifying the log level, payload, SPAN if using Jaeger and a tag object with key-value pairs.
63 |
64 | ```
65 | log('info', {
66 | message: 'Log message here',
67 | key1: value1,
68 | key2: value2
69 | });
70 | ```
71 |
72 | Use the toggles provided in config to decide where you want to write logs. By default, console logging is enabled and file logging is disabled but this can be changed by using the config.
73 |
74 | ## Static Files
75 |
76 | You can place all your static files in the `public` directory and that will get served by the server directly
77 |
78 | ## Exposing Metrics
79 |
80 | The project is bundled with [prom-client](https://github.com/siimon/prom-client) to enable exporting the metrics to prometheus with ease. You can access the default metrics at "/metrics" endpoint. You can modify what you export in `src/app/controllers/metrics.server.controllers.ts`
81 |
82 | ## Formatting
83 |
84 | The project comes with prettier configs and extensions built in.
85 |
86 | You can format the project manually by running the command `npm run format` and prettier will format the project for you.
87 |
88 | You may want to install an extension for your IDE though. More details on the same is available at https://prettier.io
89 |
90 | ## Linting
91 |
92 | You can customize rules if needed using the .eslintrc file placed in the root directory. If you are using VSCode, you can have the ESLint extension installed. While linting is run everytime you build/start the server, you can manually run it by `npm run lint`
93 |
94 | ## Generate API Documentation (OpenAPI/Swagger)
95 |
96 | You can generate documentation site by providing details regarding all the endpoints in the `apidoc.yaml` file in the root and once done, you can start the server and your documentation will get exposed in `/api-docs` URL. You can use tools like [OpenAPI GUI](https://mermade.github.io/openapi-gui/) to help generate the YAML file for you.
97 |
98 | ## Generate Code Documentation
99 |
100 | You can generate documentation based on your code by running `npm run document`. Once generated, you can find the documentation in the docs folder. See [this](http://typedoc.org/guides/doccomments/) to know how to document your code to be rendered by the doc generator.
101 |
102 | ## JWT Authentication
103 |
104 | Helpers Utilities for doing JWT authentication is added to `src/app/utils/auth.utils.ts` and controllers for the same in `src/app/controllers/auth.server.controller.ts`. The private and public keys are placed in the `creds` folder. You can generate your own by using tools like [this](http://travistidwell.com/jsencrypt/demo/).
105 |
106 | No database implementation has been made so far and hence you may need to add your own tables/collections, create users, store secret keys, etc. which is more of an implementation detail.
107 |
108 | ## Editorconfig
109 |
110 | A .editorconfig file has been added to the project to enable consistency in development across different IDEs used by different developers. Visit http://editorconfig.org for more information. You might have to install plugins in your editor to get this to work.
111 |
112 | ## Running Tests
113 |
114 | You can run your tests by using `npm run test` command. The project is bundled with [AVA](https://github.com/avajs/ava) as the test framework.
115 |
116 | ## Environmental Variables
117 |
118 | You can set up the environmental variables in the .env file and that will get used in files like docker-compose, Dockerfile, etc. In addition to this, you can set up the rest of the environmental configurations in `config/env/yourenv.ts` where yourenv can be anything and the respective configs will get loaded depending on env you set.
119 |
120 | ## Development vs Production Environment
121 |
122 | The development and production environments has some notable differences in their implementation. Everything is handled automatically when run with the right compose file.
123 |
124 | 1. Use of `nodemon` in development and directly running with `node` in production
125 | 2. `Single Stage Build` for Docker image in development and `Multi Stage Build` for Docker image in production
126 | 3. `src` mounted as volume in development and `no volume mount` in production
127 | 4. `All files copied` to container in development and `only necessary files copied` to container in production
128 | 5. `devDependencies installed` in development but `devDependencies ignored` in production
129 |
130 | ## Compatibility
131 |
132 | Since this project uses all the latest features of the node ecosystem, it requires Node >= v10.0.0
133 |
134 | ## Contributors
135 |
136 | 1. Vignesh T.V. - https://www.tvvignesh.com
137 |
138 | ## Contributing Guide
139 |
140 | 1. Find any bugs? Please raise it as an issue.
141 | 2. Have something to contribute? Please raise a pull request.
142 | 3. Looking for enhancements? Please check the milestones, and if you don't find it, raise an issue.
143 |
144 | ## Using this Project?
145 |
146 | Incase you are using this project, please let me know by dropping me a mail to vigneshviswam@gmail.com or raising an issue, I will add you to the list of users.
147 |
148 | ## Donations?
149 |
150 | Since I am doing this project purely out of interest, I am not looking for donations. But, if you want to do something, donate for charity on behalf of this project and I will add you to the contributors list.
151 |
152 | ### License
153 |
154 | MIT
155 |
--------------------------------------------------------------------------------
/docs/modules/_schema_schema_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "schema/schema" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "schema/schema"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_config_env_all_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "config/env/all" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "config/env/all"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_config_env_alpha_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "config/env/alpha" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "config/env/alpha"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_config_env_secure_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "config/env/secure" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "config/env/secure"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_app_utils_main_utils_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "app/utils/main.utils" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "app/utils/main.utils"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_config_env_production_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "config/env/production" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "config/env/production"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_app_db_schema_dbschema_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "app/db/schema/dbschema" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "app/db/schema/dbschema"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_config_env_development_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "config/env/development" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "config/env/development"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_app_routes_api_server_routes_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "app/routes/api.server.routes" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "app/routes/api.server.routes"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/docs/modules/_app_routes_root_server_routes_.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | "app/routes/root.server.routes" | Documentation
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | - Preparing search index...
23 | - The search index is not available
24 |
25 |
Documentation
26 |
27 |
47 |
48 |
49 |
50 |
51 |
52 |
60 |
External module "app/routes/root.server.routes"
61 |
62 |
63 |
64 |
146 |
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------