File tree Expand file tree Collapse file tree 7 files changed +10
-15
lines changed Expand file tree Collapse file tree 7 files changed +10
-15
lines changed Original file line number Diff line number Diff line change 11#  Here we are getting our node as Base image
2- FROM  node:18.12.1 
2+ FROM  node:20.10.0 
33
44#  create user in the docker image
55USER  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
9494    *  Install Docker and Docker Compose. [ Find Instructions Here] ( https://docs.docker.com/install/ ) .
9595    *  Execute ` docker-compose up -d `  in terminal from the repo directory.
9696    *  You will be able to access the api from http://localhost:3000 
97+     *  Run Tests: ` docker exec -t app npm test ` 
9798    *  * If having any issue*  then make sure 3000 port is not occupied else provide a different port in ** .env**  file.
9899    *  * If having any issue*  then make sure 27017 port is not occupied else provide a different port in ** .env**  file.
99100 *  Run The Tests
@@ -346,7 +347,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
346347
347348### License 
348349``` 
349-    Copyright (C) 2023  JANISHAR ALI ANWAR
350+    Copyright (C) 2024  JANISHAR ALI ANWAR
350351
351352   Licensed under the Apache License, Version 2.0 (the "License");
352353   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:
2727
2828  mongo :
2929    #  To create this service, Compose will pull the mongo
30-     image : mongo:6 .0.3  
30+     image : mongo:7 .0.4  
3131    container_name : mongo 
3232    restart : unless-stopped 
3333    #  This tells Compose that we would like to add environment variables
@@ -50,7 +50,7 @@ services:
5050      - dbdata:/data/db 
5151
5252  redis :
53-     image : redis:7.0.5  
53+     image : redis:7.2.3  
5454    container_name : redis 
5555    restart : unless-stopped 
5656    env_file : .env 
Original file line number Diff line number Diff line change 11import  express  from  'express' ; 
22import  ApiKeyRepo  from  '../database/repository/ApiKeyRepo' ; 
33import  {  ForbiddenError  }  from  '../core/ApiError' ; 
4- import  Logger  from  '../core/Logger' ; 
54import  {  PublicRequest  }  from  'app-request' ; 
65import  schema  from  './schema' ; 
76import  validator ,  {  ValidationSource  }  from  '../helpers/validator' ; 
@@ -18,7 +17,6 @@ export default router.use(
1817
1918    const  apiKey  =  await  ApiKeyRepo . findByKey ( key ) ; 
2019    if  ( ! apiKey )  throw  new  ForbiddenError ( ) ; 
21-     Logger . info ( apiKey ) ; 
2220
2321    req . apiKey  =  apiKey ; 
2422    return  next ( ) ; 
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { readFile } from 'fs';
33import  {  promisify  }  from  'util' ; 
44import  {  sign ,  verify  }  from  'jsonwebtoken' ; 
55import  {  InternalError ,  BadTokenError ,  TokenExpiredError  }  from  './ApiError' ; 
6- import  Logger  from  './Logger' ; 
76
87/* 
98 * issuer 		— Software organization who issues the token. 
@@ -67,7 +66,6 @@ async function validate(token: string): Promise<JwtPayload> {
6766    // @ts -ignore 
6867    return  ( await  promisify ( verify ) ( token ,  cert ) )  as  JwtPayload ; 
6968  }  catch  ( e : any )  { 
70-     Logger . debug ( e ) ; 
7169    if  ( e  &&  e . name  ===  'TokenExpiredError' )  throw  new  TokenExpiredError ( ) ; 
7270    // throws error if the token has not been encrypted by the private key 
7371    throw  new  BadTokenError ( ) ; 
@@ -85,7 +83,6 @@ async function decode(token: string): Promise<JwtPayload> {
8583      ignoreExpiration : true , 
8684    } ) )  as  JwtPayload ; 
8785  }  catch  ( e )  { 
88-     Logger . debug ( e ) ; 
8986    throw  new  BadTokenError ( ) ; 
9087  } 
9188} 
Original file line number Diff line number Diff line change 11import  Joi  from  'joi' ; 
22import  {  Request ,  Response ,  NextFunction  }  from  'express' ; 
3- import  Logger  from  '../core/Logger' ; 
43import  {  BadRequestError  }  from  '../core/ApiError' ; 
54import  {  Types  }  from  'mongoose' ; 
65
@@ -44,7 +43,6 @@ export default (
4443      const  message  =  details 
4544        . map ( ( i )  =>  i . message . replace ( / [ ' " ] + / g,  '' ) ) 
4645        . join ( ',' ) ; 
47-       Logger . info ( message ) ; 
4846
4947      next ( new  BadRequestError ( message ) ) ; 
5048    }  catch  ( error )  { 
Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ DB_NAME=blogs-test-db
1818DB_MIN_POOL_SIZE=2
1919DB_MAX_POOL_SIZE=5
2020
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
2526
2627DB_PORT=27017
2728
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments