Skip to content

Commit

Permalink
first version of the template completed
Browse files Browse the repository at this point in the history
  • Loading branch information
matias1305 committed May 5, 2019
0 parents commit 0cbdffe
Show file tree
Hide file tree
Showing 12 changed files with 793 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

node_modules/
.jshintrc
yarn.lock
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@


# Folders
dist/
node_modules/

# OTHERS
yarn.lock
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:alpine

WORKDIR /app

COPY package.json .

RUN npm install

COPY dist .

ENV PORT 8080

EXPOSE 8080/tcp

CMD ["node", "index"]
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Template microservices (node + express) #

## Release notes ##
| Modules | Version |
|:-----------: |:-------: |
| body-parser | ^1.19.0 |
| cors | ^2.8.5 |
| express | ^4.16.4 |

### tree files ###
```
/template
| node_modules/
| dist/
| src/
|____ class/
|____ global/
|____ routes/
|____ global/
|____ middleware/
|____ index.ts
| .dockerignore
| .jshintrc
| Dockerfile
| package.lock.json
| package.json
| README.md
| tsconfig.json
```


### Typescript compilation ###
```
tsc -w
```

### How to execute local? ###
node command
```
$ node dist/index.js
```

nodemon command
```
$ nodemon dist/index.js
```

### How to execute in Docker? ###
| Docker attribute | Attribute |
|:---------------: |:----------: |
| IMAGE | node:alpine |
| PORT EXPOSE | 8080 |

build Dockerfile
```
$ docker build -t micro/<name>:<tag> .
```

run container
```
$ docker run -d --name <name> -p 8080:8080 micro/<name>:<tag>
```
Loading

0 comments on commit 0cbdffe

Please sign in to comment.