Skip to content

Commit

Permalink
Fixes for 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
javieraviles committed Sep 7, 2018
1 parent 5792825 commit bbebc29
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ To install or update these dependencies you can use `npm install` or `npm update

## Changelog

### 1.4.1
- Fix -> After updating winston to 3.0.0, it was throwing an error when logging errors into file
- Fix -> Config in config.ts wasn't implementing IConfig interface

### 1.4.0
- Dotenv lib updated, no changes needed (they are dropping node4 support)
- Class-validator lib updated, no chages needed (cool features added like IsPhoneNumber or custom context for decorators)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-typescript-koa-rest",
"version": "1.4.0",
"version": "1.4.1",
"description": "API REST using NodeJS and KOA framework, typescript. TypeORM for SQL with class-validators. Middlewares JWT, CORS, Winston Logger.",
"main": "dist/server.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ dotenv.config({ path: '.env' });
export interface IConfig {
port: number;
debugLogging: boolean;
DbSslConn: boolean;
dbsslconn: boolean;
jwtSecret: string;
databaseUrl: string;
}

const config = {
port: process.env.PORT || 3000,
const config: IConfig = {
port: +process.env.PORT || 3000,
debugLogging: process.env.NODE_ENV == 'development',
dbsslconn: process.env.NODE_ENV != 'development',
jwtSecret: process.env.JWT_SECRET || 'your-secret-whatever',
Expand Down
8 changes: 4 additions & 4 deletions src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export function logger(winstonInstance) {
winstonInstance.configure({
level: config.debugLogging ? 'debug' : 'info',
transports: [
//
// - Write all logs error (and below) to `error.log`.
new winston.transports.File({ filename: 'error.log', level: 'error' }),
//
// - Write to all logs with specified level to console.
new winston.transports.Console({ format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
) }),
//
// - Write all logs error (and below) to `error.log`.
new winston.transports.File({ filename: 'error.log', level: 'info' })
) })
]
});

Expand Down

0 comments on commit bbebc29

Please sign in to comment.