File tree 7 files changed +10
-15
lines changed
7 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 1
1
# Here we are getting our node as Base image
2
- FROM node:18.12.1
2
+ FROM node:20.10.0
3
3
4
4
# create user in the docker image
5
5
USER node
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
94
94
* Install Docker and Docker Compose. [ Find Instructions Here] ( https://docs.docker.com/install/ ) .
95
95
* Execute ` docker-compose up -d ` in terminal from the repo directory.
96
96
* You will be able to access the api from http://localhost:3000
97
+ * Run Tests: ` docker exec -t app npm test `
97
98
* * If having any issue* then make sure 3000 port is not occupied else provide a different port in ** .env** file.
98
99
* * If having any issue* then make sure 27017 port is not occupied else provide a different port in ** .env** file.
99
100
* Run The Tests
@@ -346,7 +347,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
346
347
347
348
### License
348
349
```
349
- Copyright (C) 2023 JANISHAR ALI ANWAR
350
+ Copyright (C) 2024 JANISHAR ALI ANWAR
350
351
351
352
Licensed under the Apache License, Version 2.0 (the "License");
352
353
you may not use this file except in compliance with the License.
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ services:
27
27
28
28
mongo :
29
29
# To create this service, Compose will pull the mongo
30
- image : mongo:6 .0.3
30
+ image : mongo:7 .0.4
31
31
container_name : mongo
32
32
restart : unless-stopped
33
33
# This tells Compose that we would like to add environment variables
@@ -50,7 +50,7 @@ services:
50
50
- dbdata:/data/db
51
51
52
52
redis :
53
- image : redis:7.0.5
53
+ image : redis:7.2.3
54
54
container_name : redis
55
55
restart : unless-stopped
56
56
env_file : .env
Original file line number Diff line number Diff line change 1
1
import express from 'express' ;
2
2
import ApiKeyRepo from '../database/repository/ApiKeyRepo' ;
3
3
import { ForbiddenError } from '../core/ApiError' ;
4
- import Logger from '../core/Logger' ;
5
4
import { PublicRequest } from 'app-request' ;
6
5
import schema from './schema' ;
7
6
import validator , { ValidationSource } from '../helpers/validator' ;
@@ -18,7 +17,6 @@ export default router.use(
18
17
19
18
const apiKey = await ApiKeyRepo . findByKey ( key ) ;
20
19
if ( ! apiKey ) throw new ForbiddenError ( ) ;
21
- Logger . info ( apiKey ) ;
22
20
23
21
req . apiKey = apiKey ;
24
22
return next ( ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { readFile } from 'fs';
3
3
import { promisify } from 'util' ;
4
4
import { sign , verify } from 'jsonwebtoken' ;
5
5
import { InternalError , BadTokenError , TokenExpiredError } from './ApiError' ;
6
- import Logger from './Logger' ;
7
6
8
7
/*
9
8
* issuer — Software organization who issues the token.
@@ -67,7 +66,6 @@ async function validate(token: string): Promise<JwtPayload> {
67
66
// @ts -ignore
68
67
return ( await promisify ( verify ) ( token , cert ) ) as JwtPayload ;
69
68
} catch ( e : any ) {
70
- Logger . debug ( e ) ;
71
69
if ( e && e . name === 'TokenExpiredError' ) throw new TokenExpiredError ( ) ;
72
70
// throws error if the token has not been encrypted by the private key
73
71
throw new BadTokenError ( ) ;
@@ -85,7 +83,6 @@ async function decode(token: string): Promise<JwtPayload> {
85
83
ignoreExpiration : true ,
86
84
} ) ) as JwtPayload ;
87
85
} catch ( e ) {
88
- Logger . debug ( e ) ;
89
86
throw new BadTokenError ( ) ;
90
87
}
91
88
}
Original file line number Diff line number Diff line change 1
1
import Joi from 'joi' ;
2
2
import { Request , Response , NextFunction } from 'express' ;
3
- import Logger from '../core/Logger' ;
4
3
import { BadRequestError } from '../core/ApiError' ;
5
4
import { Types } from 'mongoose' ;
6
5
@@ -44,7 +43,6 @@ export default (
44
43
const message = details
45
44
. map ( ( i ) => i . message . replace ( / [ ' " ] + / g, '' ) )
46
45
. join ( ',' ) ;
47
- Logger . info ( message ) ;
48
46
49
47
next ( new BadRequestError ( message ) ) ;
50
48
} catch ( error ) {
Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ DB_NAME=blogs-test-db
18
18
DB_MIN_POOL_SIZE=2
19
19
DB_MAX_POOL_SIZE=5
20
20
21
- #localhost or IP of the server
22
- # YOUR_TEST_MONGO_DB_HOST_NAME
23
- DB_HOST=localhost
24
- # DB_HOST=mongo
21
+ # localhost or IP of the server
22
+ # If using the docker installation then use 'mongo' for host name else localhost or ip or db server
23
+ # YOUR_MONGO_DB_HOST_NAME
24
+ # DB_HOST=localhost
25
+ DB_HOST=mongo
25
26
26
27
DB_PORT=27017
27
28
You can’t perform that action at this time.
0 commit comments