Skip to content

Commit

Permalink
Terser minimizer (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ealenn authored Feb 1, 2020
1 parent 7c89554 commit cacfbb6
Show file tree
Hide file tree
Showing 11 changed files with 4,877 additions and 182 deletions.
135 changes: 127 additions & 8 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.github
.gitignore
docs
README.md
*.md

# Logs
logs
Expand All @@ -28,11 +28,130 @@ coverage
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
server/*.spec.js
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Tests
test/

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
!docs/*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# react / gatsby
public/

# build output
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Charts
kubernetes
charts
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
2 changes: 1 addition & 1 deletion .github/workflows/nodejs-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: nodejs-tests
name: NodeJS Tests

on:
push:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ typings/
# react / gatsby
public/

# build output
dist

# vuepress build output
.vuepress/dist

Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM mhart/alpine-node:6 as build
FROM mhart/alpine-node:8 as build
WORKDIR /build
COPY package.json .
COPY package-lock.json .
RUN npm install --production
RUN rm ./package.json package-lock.json
RUN npm install
COPY . .
RUN npm run build

FROM mhart/alpine-node:slim-6
WORKDIR /app
COPY --from=build ./build .
COPY ./src .
COPY ./src/global.json .
COPY --from=build /build/dist/webserver.js .

ENTRYPOINT [ "node", "webserver" ]
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Available:

## Default response

I use [jq](https://stedolan.github.io/jq) for nice `curl` results ;)

![curl](https://ealenn.github.io/Echo-Server/assets/images/curl.png)

## Custom response
Expand All @@ -59,7 +61,7 @@ HTTP/1.1 404 Not Found

```bash
➜ curl --header 'ECHO_BODY: amazing' localhost:3000
➜ curl localhost:3000/?echo_env_body=amazing
➜ curl localhost:3000/?echo_body=amazing

"amazing"
```
Expand All @@ -71,6 +73,15 @@ HTTP/1.1 404 Not Found
"/root"
```

```bash
# You can combine actions
➜ curl --header 'ECHO_CODE: 401' --header 'ECHO_BODY: Oups' localhost:3000
➜ curl "localhost:3000/?echo_body=Oups&echo_code=401"

HTTP/1.1 401 Unauthorized
"Oups"
```

## Docker

[Read the docs](https://ealenn.github.io/Echo-Server/pages/docker.html)
Expand Down
11 changes: 10 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ HTTP/1.1 404 Not Found

```bash
➜ curl --header 'ECHO_BODY: amazing' localhost:3000
➜ curl localhost:3000/?echo_env_body=amazing
➜ curl localhost:3000/?echo_body=amazing

"amazing"
```
Expand All @@ -68,6 +68,15 @@ HTTP/1.1 404 Not Found
"/root"
```

```bash
# You can combine actions
➜ curl --header 'ECHO_CODE: 401' --header 'ECHO_BODY: Oups' localhost:3000
➜ curl "localhost:3000/?echo_body=Oups&echo_code=401"

HTTP/1.1 401 Unauthorized
"Oups"
```

---

{% include_relative pages/includes/section-configuration.md %}
Loading

0 comments on commit cacfbb6

Please sign in to comment.