瀏覽代碼

add express js server for production

pull/44/head
Guillaume Vincent 8 年之前
父節點
當前提交
180cb8cc8c
共有 5 個文件被更改,包括 29 次插入5 次删除
  1. +10
    -0
      Dockerfile
  2. +2
    -2
      README.md
  3. +4
    -2
      package.json
  4. +12
    -0
      server.js
  5. +1
    -1
      webpack.config.js

+ 10
- 0
Dockerfile 查看文件

@@ -0,0 +1,10 @@
FROM node:argon

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY package.json /usr/src/app/
ONBUILD RUN npm install
ONBUILD COPY . /usr/src/app

CMD [ "npm", "start" ]

+ 2
- 2
README.md 查看文件

@@ -19,7 +19,7 @@ move inside lesspass folder
start application
npm start
npm run dev
open the application in a browser: [http://localhost:8080](http://localhost:8080)
@@ -39,4 +39,4 @@ run test in watch mode
## build for production
npm run build
npm start

+ 4
- 2
package.json 查看文件

@@ -7,9 +7,10 @@
"test": "mocha --compilers js:babel-core/register tests",
"test:watch": "npm run test -- -w",
"prestart": "npm install",
"start": "webpack-dev-server --inline --hot --host 0.0.0.0",
"dev": "webpack-dev-server --inline --hot --host 0.0.0.0",
"prebuild": "rimraf dist && npm prune",
"build": "NODE_ENV=production webpack --progress --hide-modules"
"build": "NODE_ENV=production webpack --progress --hide-modules",
"start": "npm run build && NODE_ENV=production node server.js"
},
"repository": {
"type": "git",
@@ -28,6 +29,7 @@
"dependencies": {
"bootstrap": "^4.0.0-alpha.2",
"clipboard": "^1.5.5",
"express": "^4.13.4",
"font-awesome": "^4.5.0",
"jquery": "^2.2.0",
"tether": "^1.1.1",


+ 12
- 0
server.js 查看文件

@@ -0,0 +1,12 @@
var express = require('express');
var app = express();

app.use('/dist', express.static(__dirname + '/dist'));

app.get('*', function (req, res) {
res.sendFile(__dirname + '/index.html');
});

app.listen(8080, function () {
console.log('LessPass frontend listening on port 8080');
});

+ 1
- 1
webpack.config.js 查看文件

@@ -1,7 +1,7 @@
var webpack = require('webpack');

module.exports = {
entry: './app/main.js',
entry: ['./app/main.js'],
output: {
path: './dist',
publicPath: '/dist/',


Loading…
取消
儲存