Skip to content

Commit

Permalink
feat: block-1371 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tomedalya committed Jan 22, 2024
0 parents commit d669043
Show file tree
Hide file tree
Showing 22 changed files with 16,962 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BASIC_AUTH_INTERNAL_USERNAME=admin
BASIC_AUTH_INTERNAL_PASSWORD=admin
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules/
.env
.idea/

dist
coverage
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
############### Stage 1 ###############
FROM node:16-alpine

# Create build directory
WORKDIR /usr/src/build

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm ci

# Bundle app source
COPY . ./

RUN npm run build

############### Stage 2 ###############

FROM node:16-alpine

# Create app directory
WORKDIR /usr/src/app

COPY package*.json ./
RUN npm ci --omit=dev --ignore-scripts

# copy build file
COPY --from=0 /usr/src/build/dist ./dist

EXPOSE 8000

CMD [ "npm", "run", "start" ]
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# decoder-service

To run the server run and listen to new changes run
`npm run dev`

to build docker image run
`docker build . --file Dockerfile --tag decoder-service:0.0.1`

to run docker image
`docker run -p 8001:8000 decoder-service:0.0.1`
will be available under `http://localhost:8001` port can be changed in the previous command

Project structure
* routes - application routes
* public - routes without protection
* internal - routes with basic auth protection
* config - middlewares, logger config, ...
* models - DB models
* services - business logic


> **Warning**
>
> **Github action might fail**
>
>
> We try to fetch contract service image from ECR which require token
> the token is valid for 12 hours, and we will need to update it.
> we have followup ticket to fix it for permanent solution but until then
> we can generate new token by using this command and update it in the
> Github secrets
>
> to get a new token run this command
> ``aws ecr get-login-password --region us-east-1``
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
],
exclude: /node_modules/,
};
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.7'
services:
mongodb_container:
image: mongo:latest
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootpassword
ports:
- 27017:27017
volumes:
- mongodb_data_container:/data/db

volumes:
mongodb_data_container:
12 changes: 12 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require('dotenv').config({path: `.env.test`});


module.exports = {
"coveragePathIgnorePatterns": [
"/node_modules/"
],
// make sure that logs will appear only for failed tests
reporters: [
'./test/resource/reporter.js',
]
}
Loading

0 comments on commit d669043

Please sign in to comment.