Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use nginx on production, express for dev #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Built
public/*
!public/index.html
!public/favicon.ico

# Logs
logs
*.log
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM node:4.2.2-onbuild
RUN npm install -g gulp
RUN gulp build
RUN npm uninstall -g gulp
EXPOSE 3000
FROM nginx
COPY public /usr/share/nginx/html
EXPOSE 80
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ begin using the application.
$ docker build --no-cache --rm --tag=newsify-gui .

# Run
$ docker run --publish 3000:3000 --rm --name=newsify-gui newsify-gui
$ docker run --publish 80:80 --rm --name=newsify-gui newsify-gui
```

How to load test on [loader.io](https://loader.io/):
```sh
# Before run, set:
$ export LOADER_IO_TOKEN="LOADER_IO_TOKEN"
```
##### Publish

Make sure to build first with `gulp build`. Then proceed tagging.

#### Notes:

Expand Down
8 changes: 1 addition & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ app.get('/', function(req, res) {
res.render('public/index.html');
});

app.get('/' + (process.env.LOADER_IO_TOKEN || 'echo'), function(req, res) {
var filename = process.env.LOADER_IO_TOKEN + ".txt";
res.set({"Content-Disposition":"attachment; filename=\"" + filename + "\""});
res.send(process.env.LOADER_IO_TOKEN);
});

app.get('*', function(req, res) {
res.redirect('/');
});

var server = app.listen(process.env.PORT || 3000, function () {
var host = server.address().address;
var port = server.address().port;

console.log("Express.js server is only for local development.");
console.log('Running at http://%s:%s', host, port);
});
Loading