Skip to content

Commit e10c30d

Browse files
initial commit
1 parent 89d3752 commit e10c30d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+13751
-0
lines changed

Diff for: .dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
npm-debug.log
3+
uploads
4+
dist
5+
.vscode

Diff for: .env.sample

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
HOST='0.0.0.0'
2+
PORT='4242'
3+
API_BASE='/api/v1'
4+
BASE_URL='http://localhost:4242/api/v1'
5+
UPLOADS='D:\www\nodejs\uploads\'
6+
7+
DEFAULT_TIMEZONE='Asia/Kolkata'
8+
JWT_SECRET='p[V(<8^sp,$vyZ3kw'
9+
SESS_SECRET='8jdP]yZb*f"']x<T^65Us7pG%'
10+
11+
DB_HOST='localhost'
12+
DB_PORT='27017'
13+
DB_AUTH='false'
14+
DB_USER='xxxx'
15+
DB_PASS='xxxx'
16+
DB_NAME='energizedhealth'
17+
18+
MYSQL_HOST='localhost'
19+
MYSQL_DB='xxxx'
20+
MYSQL_USER='xxxx'
21+
MYSQL_PASS='xxxx'
22+
MYSQL_PORT='3308'
23+
24+
SMTP_HOST='smtp.mailgun.org'
25+
SMTP_PORT='587'
26+
SMTP_USER='xxxx'
27+
SMTP_PASS='xxxx'

Diff for: .eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/node_modules

Diff for: .eslintrc.yaml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# ESLint configuration
2+
# Intended to be a strict superset of Node core style, with the exception of
3+
# rules which would cause breakage in supported Node versions.
4+
# Uses Airbnb's styles where they don't conflict with Node core or my prefs.
5+
---
6+
extends: standard
7+
env:
8+
node: true
9+
mocha: true
10+
es6: true
11+
parser: '@typescript-eslint/parser'
12+
parserOptions:
13+
sourceType: module
14+
ecmaVersion: 6
15+
rules:
16+
generator-star-spacing:
17+
- 2
18+
- before: true
19+
after: true
20+
no-shadow: 0
21+
import/no-unresolved: 0
22+
import/extensions: 0
23+
require-yield: 0
24+
no-param-reassign: 0
25+
comma-dangle: 0
26+
no-underscore-dangle: 0
27+
no-control-regex: 0
28+
import/no-extraneous-dependencies:
29+
- 2
30+
- devDependencies: true
31+
func-names: 0
32+
no-unused-expressions: 0
33+
prefer-arrow-callback: 1
34+
no-use-before-define:
35+
- 2
36+
- functions: false
37+
space-before-function-paren:
38+
- 2
39+
- always
40+
max-len:
41+
- 2
42+
- 180
43+
- 2
44+
semi:
45+
- 2
46+
- never
47+
strict:
48+
- 2
49+
- global
50+
arrow-parens:
51+
- 2
52+
- always
53+
# custom rules
54+
import/prefer-default-export: 0
55+
no-plusplus: 0
56+
no-console: 0
57+
no-undef: 0
58+
new-cap: 0
59+
no-unused-vars: 0
60+
quote-props: 0
61+
dot-notation: 0
62+
63+
# vi: set sts=2 sw=2 et ft=yaml:

Diff for: .prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"printWidth": 80
5+
}
6+

Diff for: README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# City of Glendale - Beeline
2+
3+
4+
```
5+
cd existing_repo
6+
git remote add origin
7+
git branch -M main
8+
git push -uf origin main
9+
```
10+
### Development
11+
12+
```bash
13+
npm run dev
14+
```
15+
16+
### Production
17+
18+
```bash
19+
pm2 start ecosystem.config.js --env production
20+
```
21+
22+
### Running tests
23+
24+
```bash
25+
npm test
26+
```
27+
28+
### Linting
29+
30+
```bash
31+
npm run lint
32+
```
33+
34+
### Building a container
35+
36+
```bash
37+
docker build -t rahulse97/rest-api-typescript .
38+
```
39+
40+
### Run docker image
41+
42+
```bash
43+
docker run -p 8080:3000 -d rahulse97/rest-api-typescript
44+
```
45+
46+
### Print app output
47+
```bash
48+
docker logs <container id>
49+
```
50+
51+
### Enter the container
52+
```bash
53+
docker exec -it <container id> /bin/bash
54+
```

Diff for: ecosystem.config.js

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
const baseEnv = {
2+
'NODE_ENV': 'development',
3+
'HOST': '0.0.0.0',
4+
'PORT': '4242',
5+
'API_BASE': '/api/v1',
6+
'API_URL': 'http://localhost:4242/api/v1',
7+
'BASE_URL': 'http://localhost:4242/api/v1',
8+
'ADMIN_URL': 'http://localhost:4242/api/v',
9+
'VIDEOS_DIR': '/Web_Data/Videos/',
10+
'UPLOADS_DIR': '/Web_Data/Uploads/',
11+
12+
'DEFAULT_TIMEZONE': 'Asia/Kolkata',
13+
'JWT_SECRET': 'p[V(<8^sp,$vyZ3kwKbu>9_#K',
14+
'SESS_SECRET': '8jdP]yZb*f"]x<T^65Us7pG%',
15+
'BASIC_AUTH_PASS': 'p@$$w0rd',
16+
17+
'DB_HOST': 'localhost',
18+
'DB_PORT': '27017',
19+
'DB_AUTH': 'false',
20+
'DB_USER': 'rahul',
21+
'DB_PASS': 'RSeth2',
22+
'DB_NAME': 'tickets',
23+
24+
'SMTP_HOST': 'smtp.mailgun.org',
25+
'SMTP_PORT': '587',
26+
'SMTP_USER': '',
27+
'SMTP_PASS': '',
28+
29+
'S3_ACCESS_KEY': '',
30+
'S3_SECRET_KEY': '',
31+
'S3_BUCKET': 'climetsafety',
32+
'S3_REGION': 'us-east-1',
33+
34+
'SES_ACCESS_KEY': '',
35+
'SES_SECRET_KEY': '+',
36+
'SES_REGION': 'ap-south-1',
37+
38+
'FEEDBACK_EMAIL': ''
39+
}
40+
41+
const baseEnvClone = Object.assign({}, baseEnv)
42+
const prodEnv = Object.assign(baseEnvClone, {
43+
'NODE_ENV': 'production',
44+
'HOST': '0.0.0.0',
45+
'PORT': '8081',
46+
'API_BASE': '/api/v1',
47+
'API_URL': 'http://localhost:4242/api/v',
48+
'API_ENV': 'AWS',
49+
'ADMIN_URL': 'http://localhost:4242/api/v',
50+
'UPLOADS_DIR': '/Web_Data/Energized_Uploads/',
51+
52+
'DEFAULT_TIMEZONE': 'Asia/Kolkata',
53+
'DB_HOST': 'localhost',
54+
'DB_PORT': '27017',
55+
'DB_AUTH': 'false',
56+
'DB_USER': 'xxxx',
57+
'DB_PASS': 'xxxx',
58+
'DB_NAME': 'safety climet'
59+
})
60+
61+
module.exports = {
62+
apps: [{
63+
name: 'safety clemet',
64+
script: './dist/index.js',
65+
66+
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
67+
node_args: '--require dotenv/config',
68+
args: '',
69+
exec_mode: 'fork',
70+
instances: 1,
71+
autorestart: true,
72+
watch: false,
73+
max_memory_restart: '1G',
74+
env: baseEnv,
75+
env_production: prodEnv
76+
}]
77+
}

Diff for: eslint

Whitespace-only changes.

Diff for: jest.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
};
5+

Diff for: nodemon.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"watch": [
3+
"dist/**/*.js"
4+
],
5+
"ext": "js",
6+
"ignore": [
7+
"dist/**/*.spec.js"
8+
],
9+
"exec": "node --require dotenv/config ./dist/index.js"
10+
}

0 commit comments

Comments
 (0)