Api Service
Api service is a service that provides api to get the data that Gcalls provides to customers
I. Functionality
- Implementing api to provide data
II. Packages
1. Dependencies
- Await-to-js - Async await wrapper for easy error handling without try-catch Await-to-js
- Axios - Promise based HTTP client for the browser and node.js Axios
- Babel-core - Babel compiler core Babel-core
- Babel-plugin-transform-object-rest-spread - Compile object rest and spread to ES5 Babel-plugin-transform-object-rest-spread
- Babel-polyfill - Provides polyfills necessary for a full ES2015+ environment Babel-polyfill
- Babel-preset-env - A Babel preset for each environment Babel-preset-env
- Babel-register - Register Babel require hook Babel-register
- Body-parser - Node.js body parsing middleware Body-parser
- Cors - Node.js CORS middleware Cors
- Dotenv - Loads environment variables from .env file Dotenv
- Ejs - Embedded JavaScript templates Ejs
- Express-session - Simple session middleware for Express Express-session
- Express - Fast, unopinionated, minimalist web framework for node Express
- Jsonfile - Easily read/write JSON files Jsonfile
- Jsonwebtoken - JSON Web Token implementation (symmetric and asymmetric) Jsonwebtoken
- Mkdirp - Recursively mkdir, like
mkdir -pMkdirp - Mongodb - The official MongoDB driver for Node.js Mongodb
- Morgan - HTTP request logger middleware for node.js Morgan
- Serve-favicon - Node.js middleware for serving a favicon Serve-favicon
- Uuid - RFC4122 (v1, v4, and v5) UUIDs Uuid
- Winston-daily-rotate-file - A transport for winston which logs to a rotating file each day Winston-daily-rotate-file
- Winston - A logger for just about everything. Winston
2. Dev dependencies
- Nodemon - Simple monitor script for use during development of a node.js app. Nodemon
III. Database
1. ERD
2. Database schema
endpoint
| Field | Type | Description |
|---|---|---|
| _id | string | name endpoint |
| blacklist | array | |
| description | string | description endpoint |
| hardLimit | number | |
| sortLimit | number | |
| whitelist | string |
key
| Field | Type | Description |
|---|---|---|
| _id | string | |
| string | ||
| description | string | description key |
| role | number | |
| domain | number | Id callcenter |
| idUser | string | id user use key |
IV. Source tree
.
├── app.js
├── .babelrc
├── config
│ ├── access.js
│ ├── admin.js
│ ├── host.js
│ ├── jwt.js
│ ├── logger.js
│ ├── mapper.json
│ ├── mongodb.js
│ └── port.js
├── Dockerfile
├ ── .dockerignore
├── .env
├── favicon.ico
├── .gitignore
├── .gitlab-ci.yml
├── index.js
├── lib
│ ├── access.js
│ ├── middleware.js
│ ├── runner.js
│ └── validator.js
├── model
│ ├── endpoint.js
│ └── key.js
├── package.json
├── package-lock.json
├── route
│ ├── endpoint.js
│ ├── index.js
│ ├── key.js
│ ├── runner.js
│ └── v1
│ ├── index.js
│ └── runner.js
├── ../static
│ ├── bootstrap-3.3.7-dist
│ │ ├── css
│ │ │ ├── bootstrap.css
│ │ │ ├── bootstrap.css.map
│ │ │ ├── bootstrap.min.css
│ │ │ ├── bootstrap.min.css.map
│ │ │ ├── bootstrap-theme.css
│ │ │ ├── bootstrap-theme.css.map
│ │ │ ├── bootstrap-theme.min.css
│ │ │ └── bootstrap-theme.min.css.map
│ │ ├── fonts
│ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ └── glyphicons-halflings-regular.woff2
│ │ └── js
│ │ ├── bootstrap.js
│ │ ├── bootstrap.min.js
│ │ └── npm.js
│ ├── font-awesome-4.7.0
│ │ ├── css
│ │ │ ├── font-awesome.css
│ │ │ └── font-awesome.min.css
│ │ ├ ── fonts
│ │ │ ├── FontAwesome.otf
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.svg
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ └── fontawesome-webfont.woff2
│ │ ├── less
│ │ │ ├── animated.less
│ │ │ ├── bordered-pulled.less
│ │ │ ├── core.less
│ │ │ ├── fixed-width.less
│ │ │ ├── font-awesome.less
│ │ │ ├── icons.less
│ │ │ ├── larger.less
│ │ │ ├── list.less
│ │ │ ├── mixins.less
│ │ │ ├── path.less
│ │ │ ├── rotated-flipped.less
│ │ │ ├── screen-reader.less
│ │ │ ├── stacked.less
│ │ │ └── variables.less
│ │ └── scss
│ │ ├── _animated.scss
│ │ ├── _bordered-pulled.scss
│ │ ├── _core.scss
│ │ ├── _fixed-width.scss
│ │ ├── font-awesome.scss
│ │ ├── _icons.scss
│ │ ├── _larger.scss
│ │ ├── _list.scss
│ │ ├── _mixins.scss
│ │ ├── _path.scss
│ │ ├── _rotated-flipped.scss
│ │ ├── _screen-reader.scss
│ │ ├── _stacked.scss
│ │ └── _variables.scss
│ ├── img
│ │ └── logo.png
│ ├── js
│ │ ├── endpoint.js
│ │ ├── jquery-3.1.1.min.js
│ │ ├── key.js
│ │ ├── sender.js
│ │ └── signin.js
│ └── oneui
│ ├── css
│ │ ├── oneui.min.css
│ │ └── themes
│ │ ├── amethyst.min.css
│ │ ├── city.min.css
│ │ ├── flat.min.css
│ │ ├── modern.min.css
│ │ └── smooth.min.css
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ ├── fontawesome-webfont.woff
│ │ ├── fontawesome-webfont.woff2
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ ├── glyphicons-halflings-regular.woff
│ │ ├── glyphicons-halflings-regular.woff2
│ │ ├── Simple-Line-Icons.eot
│ │ ├── Simple-Line-Icons.svg
│ │ ├── Simple-Line-Icons.ttf
│ │ └── Simple-Line-Icons.woff
│ ├── img
│ │ └── favicons
│ │ ├── apple-touch-icon-114x114.png
│ │ ├── apple-touch-icon-120x120.png
│ │ ├── apple-touch-icon-144x144.png
│ │ ├── apple-touch-icon-152x152.png
│ │ ├── apple-touch-icon-180x180.png
│ │ ├── apple-touch-icon-57x57.png
│ │ ├── apple-touch-icon-60x60.png
│ │ ├── apple-touch-icon-72x72.png
│ │ ├── apple-touch-icon-76x76.png
│ │ ├── favicon-160x160.png
│ │ ├── favicon-16x16.png
│ │ ├── favicon-192x192.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon-96x96.png
│ │ └── favicon.png
│ └── js
│ ├── app.js
│ ├── core
│ │ ├── bootstrap.min.js
│ │ ├── jquery.appear.min.js
│ │ ├── jquery.countTo.min.js
│ │ ├── jquery.min.js
│ │ ├── jquery.placeholder.min.js
│ │ ├── jquery.scrollLock.min.js
│ │ ├── jquery.slimscroll.min.js
│ │ └── js.cookie.min.js
│ ├── oneui.min.js
│ └── plugins
│ ├── bootstrap-colorpicker
│ │ ├── bootstrap-colorpicker.min.js
│ │ ├── css
│ │ │ └── bootstrap-colorpicker.min.css
│ │ └── img
│ │ └── bootstrap-colorpicker