Skip to content

Commit 817f6b2

Browse files
committed
Merge branch 'feature/v3' of https://github.com/w3tecch/express-typescript-boilerplate into feature/v3
2 parents e44a08b + aac3b33 commit 817f6b2

File tree

5 files changed

+62
-13
lines changed

5 files changed

+62
-13
lines changed

.env.test

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# APPLICATION
3+
#
4+
APP_NAME="express-typescript-boilerplate"
5+
APP_ROUTE="http://localhost:3000"
6+
APP_ROUTE_PREFIX="/api"
7+
APP_BANNER=false
8+
9+
#
10+
# LOGGING
11+
#
12+
LOG_LEVEL="none"
13+
LOG_JSON=false
14+
LOG_OUTPUT="dev"
15+
16+
#
17+
# AUTHORIZATION
18+
#
19+
AUTH_ROUTE="http://localhost:3333/tokeninfo"
20+
21+
#
22+
# DATABASE
23+
#
24+
DB_TYPE="mysql"
25+
DB_HOST="localhost"
26+
DB_PORT=3306
27+
DB_USERNAME="root"
28+
DB_PASSWORD=""
29+
DB_DATABASE="my_database"
30+
DB_SYNCHRONIZE=false
31+
DB_LOGGING=false
32+
33+
#
34+
# Swagger
35+
#
36+
SWAGGER_ENABLED=true
37+
SWAGGER_ROUTE="/swagger"
38+
SWAGGER_FILE="api/swagger.json"
39+
SWAGGER_USERNAME="admin"
40+
SWAGGER_PASSWORD="1234"
41+
42+
#
43+
# Status Monitor
44+
#
45+
MONITOR_ENABLED=true
46+
MONITOR_ROUTE="/monitor"
47+
MONITOR_USERNAME="admin"
48+
MONITOR_PASSWORD="1234"

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ scripts:
88
- npm start build
99
notifications:
1010
email: false
11-
env:
12-
- APP_ROUTE="http://localhost:3000"

package-scripts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,30 @@ module.exports = {
4949
migrate: {
5050
script: series(
5151
'nps banner.migrate',
52-
'nps migrate.config',
52+
'nps db.config',
5353
runFast('./node_modules/.bin/typeorm migrations:run'),
5454
),
5555
},
5656
revert: {
5757
script: series(
5858
'nps banner.revert',
59-
'nps migrate.config',
59+
'nps db.config',
6060
runFast('./node_modules/.bin/typeorm migrations:revert'),
6161
),
6262
},
6363
seed: {
6464
script: series(
6565
'nps banner.seed',
66-
'nps migrate.config',
67-
runFast('./src/lib/seeds.ts'),
66+
'nps db.config',
67+
runFast('./src/lib/seeds/'),
6868
),
6969
},
7070
config: {
7171
script: runFast('./src/lib/ormconfig.ts'),
7272
},
7373
drop: {
74-
script: runFast('./node_modules/.bin/typeorm schema:drop')
75-
}
74+
script: runFast('./node_modules/.bin/typeorm schema:drop'),
75+
},
7676
},
7777
/**
7878
* These run various kinds of tests. Default is unit.

src/core/env.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import * as path from 'path';
2-
import * as pkg from '../../package.json';
32
import * as dotenv from 'dotenv';
4-
dotenv.config();
3+
import * as pkg from '../../package.json';
54

5+
/**
6+
* Load .env file or for tests the .env.test file.
7+
*/
8+
dotenv.config({ path: path.join(process.cwd(), `.env${((process.env.NODE_ENV === 'test') ? '.test' : '')}`) });
69

710
/**
811
* Environment variables
@@ -22,7 +25,7 @@ export const env = {
2225
migrations: [path.join(__dirname, '..', 'database/migrations/*.ts')],
2326
migrationsDir: path.join(__dirname, '..', 'database/migrations'),
2427
entities: [path.join(__dirname, '..', 'api/**/models/*{.js,.ts}')],
25-
subscribers: [ path.join(__dirname, '..', 'api/**/*Subscriber{.js,.ts}')],
28+
subscribers: [path.join(__dirname, '..', 'api/**/*Subscriber{.js,.ts}')],
2629
controllers: [path.join(__dirname, '..', 'api/**/*Controller{.js,.ts}')],
2730
middlewares: [path.join(__dirname, '..', 'api/**/*Middleware{.js,.ts}')],
2831
interceptors: [path.join(__dirname, '..', 'api/**/*Interceptor{.js,.ts}')],

src/lib/seeds/FactoryInterface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export interface FactoryInterface {
99
/**
1010
* Returns an EntityFactoryInterface
1111
*/
12-
get<Entity>(entityClass: ObjectType<Entity>, args: any[]): EntityFactoryInterface<Entity>;
12+
get<Entity>(entityClass: ObjectType<Entity>, value?: any): EntityFactoryInterface<Entity>;
1313
/**
1414
* Define an entity faker
1515
*/
16-
define<Entity>(entityClass: ObjectType<Entity>, fakerFunction: (faker: typeof Faker, args: any[]) => Entity): void;
16+
define<Entity>(entityClass: ObjectType<Entity>, fakerFunction: (faker: typeof Faker, value?: any) => Entity): void;
1717
}

0 commit comments

Comments
 (0)