Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Readmes and cleanup server.js #11

Merged
merged 4 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .madgerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"excludeRegExp": [".*\\.spec\\.js", "package\\.json"]
}
14 changes: 8 additions & 6 deletions README.logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

We are currently using pino for logging. Pino logs objects/messages directly to streams so other processes can
actually handle formatting or other log actions (this is because Node is single threaded, so smarter to create
another process to manage the logs). We store all of these files in `<CONFIG.LOG.dir>/pino.log`
another process to manage the logs). We store all of these logs in `<CONFIG.LOG.dir>/pino.log`

## Configurations

Expand Down Expand Up @@ -39,12 +39,12 @@ controller({ params, logger }: HapiRequest) {


## Other processes
Other node processes should be spawned (in production and development), here are some examples of processes
we recommend:
By design, pino just outputs logs to be used by other "transporters" (other node processes spawned in
production and development) for reacting to, and viewing these logs. here are some examples of processes
we recommend implementing:

### Logrotate
By design, pino just outputs logs to be used by other "transporters". Log Rotation should be handled via
another service as described in the [pino documention](http://getpino.io/#/docs/help?id=log-rotation)
Log Rotation on production servers should be handled via another service as described in the [pino documention](http://getpino.io/#/docs/help?id=log-rotation)

### Pino-Pretty
Displays the logs in a prettier format that makes it easier to see the data, however takes up more space.
Expand Down Expand Up @@ -97,8 +97,10 @@ e.g.


## Notes/Ideas
- Log Helper for use in the dataservices
- Trace logging any external requests/responses
- Logger Helper for use in the dataservices
- goaccess?
- websocket? endpoint that shows logs in real time
- docs page for logs (searching?)
- Elasticsearch/Logstash/Kibana
- logrotate on production
7 changes: 4 additions & 3 deletions README.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ manage node versions is by using the [Node Version Manager](https://github.com/n
in the project to help reference this minimum node version.

Use `nvm use 10` to switch node versions after installing a new Node version. **Then you should install all
project dependencies**([github](https://github.com/devlinjunker/template.node.hapi/blob/master/package.json#L30))
project dependencies**([github](https://github.com/devlinjunker/template.node.hapi/blob/master/package.json#L30))
with `npm install` (or `npm install -D` if development work is planned). This should install the Hapi Server Framework,
MariaDB and other libraries used in this project.

Expand All @@ -30,7 +30,7 @@ and create Postman test suites based on these files)
## Webpack

Webpack config file([github](https://github.com/devlinjunker/template.node.hapi/blob/master/webpack.config.js))
is used to manage our webpack build to compile the application.
is used to manage our webpack build to compile the application.

In this file we:
- designate the files that will be created with the build
Expand All @@ -52,11 +52,12 @@ The Dependency Graph is created with [Madge](https://github.com/pahen/madge) and
install both in order to update the dependency graph. I didn't include these in the package.json dependencies
because I felt this is more than is needed to develop a working app or even write basic documentation.

Install madge with `npm install madge` and install graphviz with `brew install graphviz` or
Install madge with `npm install -g madge` and install graphviz with `brew install graphviz` or
`port install graphviz` (for OSX)

I split this out to a separate npm script: `npm run doc-image`


## Notes/Ideas
- **IDEA:** init scripts with installation and SQL setup
- Explore madge options: https://www.npmjs.com/package/madge#configuration
252 changes: 252 additions & 0 deletions docs/ast/source/base/request/hapi-request.interface.js.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
{
"type": "File",
"start": 0,
"end": 333,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"program": {
"type": "Program",
"start": 0,
"end": 333,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"sourceType": "module",
"body": [
{
"type": "EmptyStatement",
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
},
"leadingComments": null,
"trailingComments": [
{
"type": "CommentBlock",
"value": "*\n * Hapi Handler for returning messages or setting error codes during requests\n * @type {HapiHandler}\n ",
"start": 3,
"end": 111,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": " eslint-disable flowtype/no-weak-types ",
"start": 113,
"end": 156,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 43
}
}
},
{
"type": "CommentBlock",
"value": "*\n* Request Object that is passed to the controller function as the first parameter\n* from https://github.com/hapijs/hapi/blob/master/API.md#request\n* @type {HapiRequest}\n",
"start": 158,
"end": 333,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
}
}
]
}
],
"directives": []
},
"comments": [
{
"type": "CommentBlock",
"value": "*\n * Hapi Handler for returning messages or setting error codes during requests\n * @type {HapiHandler}\n ",
"start": 3,
"end": 111,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": " eslint-disable flowtype/no-weak-types ",
"start": 113,
"end": 156,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 43
}
}
},
{
"type": "CommentBlock",
"value": "*\n* Request Object that is passed to the controller function as the first parameter\n* from https://github.com/hapijs/hapi/blob/master/API.md#request\n* @type {HapiRequest}\n",
"start": 158,
"end": 333,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
}
}
],
"tokens": [
{
"type": {
"label": ";",
"beforeExpr": true,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 0,
"end": 1,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
}
},
{
"type": "CommentBlock",
"value": "*\n * Hapi Handler for returning messages or setting error codes during requests\n * @type {HapiHandler}\n ",
"start": 3,
"end": 111,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 6,
"column": 3
}
}
},
{
"type": "CommentBlock",
"value": " eslint-disable flowtype/no-weak-types ",
"start": 113,
"end": 156,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 8,
"column": 43
}
}
},
{
"type": "CommentBlock",
"value": "*\n* Request Object that is passed to the controller function as the first parameter\n* from https://github.com/hapijs/hapi/blob/master/API.md#request\n* @type {HapiRequest}\n",
"start": 158,
"end": 333,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
}
},
{
"type": {
"label": "eof",
"beforeExpr": false,
"startsExpr": false,
"rightAssociative": false,
"isLoop": false,
"isAssign": false,
"prefix": false,
"postfix": false,
"binop": null,
"updateContext": null
},
"start": 333,
"end": 333,
"loc": {
"start": {
"line": 14,
"column": 2
},
"end": {
"line": 14,
"column": 2
}
}
}
]
}
Loading