Skip to content

Commit cdc0e46

Browse files
committed
feat(boilerplate): add config & default structure
0 parents  commit cdc0e46

24 files changed

+4340
-0
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# @w3tec
2+
# http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
# Use 2 spaces since npm does not respect custom indentation settings
18+
[package.json]
19+
indent_style = space
20+
indent_size = 4

.env.example

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# APPLICATION
3+
#
4+
APP_NAME=nodejs-api-boilerplate
5+
APP_SCHEMA=http
6+
APP_HOST=localhost
7+
APP_PORT=3000
8+
APP_ROUTE_PREFIX=/api
9+
APP_BANNER=true
10+
11+
#
12+
# LOGGING
13+
#
14+
LOG_LEVEL=debug
15+
LOG_OUTPUT=dev
16+
17+
#
18+
# DATABASE
19+
#
20+
DB_CONNECTION=mongodb://localhost/example
21+
DB_DATABASE=mongodb
22+
DB_LOGGING=error
23+
DB_LOGGER=advanced-console
24+
25+
#
26+
# PASSPORT
27+
#
28+
PASSPORT_JWT=jwt_example
29+
PASSPORT_JWT_ACCESS_EXPIRED=900
30+
PASSPORT_JWT_REFRESH_EXPIRED=259200
31+
32+
#
33+
# Swagger
34+
#
35+
SWAGGER_ENABLED=true
36+
SWAGGER_ROUTE=/swagger
37+
SWAGGER_USERNAME=admin
38+
SWAGGER_PASSWORD=1234
39+
40+
#
41+
# Status Monitor
42+
#
43+
MONITOR_ENABLED=true
44+
MONITOR_ROUTE=/monitor
45+
MONITOR_USERNAME=admin
46+
MONITOR_PASSWORD=1234

.env.test

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# APPLICATION
3+
#
4+
APP_NAME=nodejs-api-boilerplate
5+
APP_SCHEMA=http
6+
APP_HOST=localhost
7+
APP_PORT=3000
8+
APP_ROUTE_PREFIX=/api
9+
APP_BANNER=true
10+
11+
#
12+
# LOGGING
13+
#
14+
LOG_LEVEL=none
15+
LOG_OUTPUT=dev
16+
17+
#
18+
# DATABASE
19+
#
20+
DB_CONNECTION=mongodb://localhost/testing
21+
DB_DATABASE=mongodb
22+
DB_LOGGING=error
23+
DB_LOGGER=advanced-console
24+
25+
#
26+
# PASSPORT
27+
#
28+
PASSPORT_JWT=jwt_example
29+
PASSPORT_JWT_ACCESS_EXPIRED=900
30+
PASSPORT_JWT_REFRESH_EXPIRED=259200
31+
32+
#
33+
# Swagger
34+
#
35+
SWAGGER_ENABLED=true
36+
SWAGGER_ROUTE=/swagger
37+
SWAGGER_USERNAME=admin
38+
SWAGGER_PASSWORD=1234
39+
40+
#
41+
# Status Monitor
42+
#
43+
MONITOR_ENABLED=true
44+
MONITOR_ROUTE=/monitor
45+
MONITOR_USERNAME=admin
46+
MONITOR_PASSWORD=1234

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"jest": true
5+
},
6+
"extends": ["airbnb-base", "plugin:jest/recommended", "plugin:security/recommended", "plugin:prettier/recommended"],
7+
"plugins": ["jest", "security", "prettier"],
8+
"parserOptions": {
9+
"ecmaVersion": 2018
10+
},
11+
"rules": {
12+
// "no-console": "error",
13+
"func-names": "off",
14+
"no-underscore-dangle": "off",
15+
"consistent-return": "off",
16+
"jest/expect-expect": "off",
17+
"security/detect-object-injection": "off"
18+
}
19+
}

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Convert text file line endings to lf
2+
* text eol=lf
3+
*.js text

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Logs #
2+
/logs
3+
*.log
4+
*.log*
5+
6+
# Node files #
7+
node_modules/
8+
npm-debug.log
9+
yarn-error.log
10+
.env
11+
12+
# OS generated files #
13+
.DS_Store
14+
Thumbs.db
15+
.tmp/
16+
src/api/schema.gql
17+
18+
# Typing #
19+
typings/
20+
21+
# Dist #
22+
dist/
23+
tsconfig.build.json
24+
25+
# IDE #
26+
.idea/
27+
*.swp
28+
.awcache
29+
30+
# Generated source-code #
31+
src/**/*.js
32+
src/**/*.js.map
33+
!src/public/**/*
34+
test/**/*.js
35+
test/**/*.js.map
36+
coverage/
37+
!test/preprocessor.js
38+
mydb.sql

.lintstagedrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*.js": "eslint"
3+
}

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 4,
3+
"semi": false,
4+
"singleQuote": true,
5+
"printWidth": 125,
6+
"endOfLine": "lf"
7+
}

.runtime/banner.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const chalk = require('chalk')
2+
const figlet = require('figlet')
3+
4+
figlet.text(process.argv[2], (error, data) => {
5+
if (error) {
6+
return process.exit(1)
7+
}
8+
9+
console.log(chalk.blue(data))
10+
console.log('')
11+
return process.exit(0)
12+
})

0 commit comments

Comments
 (0)