Skip to content

Commit 2cad687

Browse files
committed
Project init.
1 parent cecf402 commit 2cad687

31 files changed

+7990
-0
lines changed

.dockerignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# add git-ignore syntax here of things you don't want copied into docker image
2+
3+
.git
4+
*Dockerfile*
5+
*docker-compose*
6+
node_modules
7+
dist
8+
.cache

.gitignore

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
hummus-error.log*
8+
9+
# Runtime data
10+
pids
11+
*.pid
12+
*.seed
13+
*.pid.lock
14+
15+
# Directory for instrumented libs generated by jscoverage/JSCover
16+
lib-cov
17+
18+
# Coverage directory used by tools like istanbul
19+
coverage
20+
21+
# nyc test coverage
22+
.nyc_output
23+
24+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
25+
.grunt
26+
27+
# Bower dependency directory (https://bower.io/)
28+
bower_components
29+
30+
# node-waf configuration
31+
.lock-wscript
32+
33+
# Compiled binary addons (https://nodejs.org/api/addons.html)
34+
build/Release
35+
36+
# Dependency directories
37+
node_modules/
38+
jspm_packages/
39+
40+
# TypeScript v1 declaration files
41+
typings/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# Yarn Integrity file
56+
.yarn-integrity
57+
58+
# dotenv environment variables file
59+
.env
60+
61+
# parcel-bundler cache (https://parceljs.org/)
62+
.cache
63+
64+
# next.js build output
65+
.next
66+
67+
# nuxt.js build output
68+
.nuxt
69+
70+
# vuepress build output
71+
.vuepress/dist
72+
73+
# Serverless directories
74+
.serverless
75+
76+
# Ignore docker volumes
77+
/volumes
78+
packages/parser/example/
79+
80+
packages/parser/pdfgenerator/output\.pdf
81+
82+
.DS_Store

Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# base image
2+
FROM node:10.5.0-slim
3+
4+
WORKDIR /usr/src/app
5+
6+
# install global dependencies
7+
RUN npm install pm2 -g
8+
RUN npm install lerna -g

docker-compose.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: '3.5'
2+
3+
services:
4+
db:
5+
image: postgres:10.4
6+
ports:
7+
- "5433:5432"
8+
volumes:
9+
- ./volumes/postgresql:/var/lib/postgresql/data
10+
11+
api:
12+
build: .
13+
volumes:
14+
- .:/usr/src/app/
15+
ports:
16+
- '8080:80'
17+
environment:
18+
- NODE_ENV=development
19+
- CHOKIDAR_USEPOLLING=true
20+
depends_on:
21+
- "db"
22+
command: ["./scripts/wait-for-it.sh", "db:5432", "--", "npm", "start"] # Wait for postgres

lerna.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"lerna": "2.11.0",
3+
"packages": [
4+
"packages/*"
5+
],
6+
"version": "0.0.0"
7+
}

package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "node_base",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "server.js",
6+
"scripts": {
7+
"start": "./scripts/start.sh",
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"author": "Yusuf YILDIRIM",
11+
"license": "ISC",
12+
"devDependencies": {
13+
"lerna": "^2.11.0"
14+
}
15+
}

packages/api/.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["env", "stage-0"]
3+
}

packages/api/.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "airbnb-base"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { LogicError } from '../utils/errors';
2+
3+
async function root(req, res) {
4+
try {
5+
// throw new LogicError('test_error')
6+
return res.json({ result: 'ok' });
7+
} catch (e) {
8+
// if you throw an error in the try block, it'll catch in this catch block
9+
// and it'll continue to the our error handling middleware
10+
next(e);
11+
}
12+
}
13+
14+
export default {
15+
root,
16+
};

packages/api/controllers/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import ExampleController from './ExampleController';
2+
3+
export {
4+
ExampleController,
5+
};

packages/api/ecosystem.config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
apps: [
3+
{
4+
name: 'API',
5+
script: 'server.js',
6+
interpreter: 'babel-node',
7+
watch: true,
8+
ignore_watch : ['node_modules'],
9+
env: {
10+
NODE_ENV: 'development',
11+
node_args: [
12+
'--inspect=0.0.0.0:9229',
13+
],
14+
},
15+
},
16+
],
17+
};

packages/api/knexfile.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module.exports = {
2+
local: {
3+
client: 'pg',
4+
connection: {
5+
host: 'localhost',
6+
database: 'postgres',
7+
user: 'postgres',
8+
password: '',
9+
port: '5433'
10+
},
11+
pool: {
12+
min: 2,
13+
max: 10,
14+
},
15+
migrations: {
16+
tableName: 'knex_migrations',
17+
},
18+
// debug: true,
19+
},
20+
development: {
21+
client: 'pg',
22+
connection: {
23+
host: 'db',
24+
database: 'postgres',
25+
user: 'postgres',
26+
password: '',
27+
},
28+
pool: {
29+
min: 2,
30+
max: 10,
31+
},
32+
migrations: {
33+
tableName: 'knex_migrations',
34+
},
35+
debug: true,
36+
},
37+
};

packages/api/models/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export {
2+
};

0 commit comments

Comments
 (0)