diff --git a/configuration.json b/configuration.json index ba5c2c90..7dd17284 100644 --- a/configuration.json +++ b/configuration.json @@ -18,15 +18,15 @@ "imagePath" : "/images", "cssPath" : "/styles" }, - "env" : "development", - "useProxy" : true, - "port" : 8012 + "env" : "development", + "useProxy" : true, + "port" : 8010, + "staticPort" : 8011 }, "go": { "Debug" : true, "URL" : "http://wemall.shen100.com", - "Port" : 8010, - "StaticPort" : 8011, + "Port" : 8012, "MaxOrder" : 10000, "MinOrder" : 0, "PageSize" : 20, @@ -48,7 +48,7 @@ "todayOrderCount": "/admin/order/todaycount", "todayOrderSale": "/admin/order/todaysale", "totalOrderCount": "/admin/order/totalcount", - "totalSale": "/admin/order/totalsale", + "totalSale": "/admin/order/totalsale" }, "docs": { "github": "https://xxx.com/shen100" diff --git a/server/config/config.go b/go/config/config.go similarity index 100% rename from server/config/config.go rename to go/config/config.go diff --git a/server/controller/admin/admin.go b/go/controller/admin/admin.go similarity index 100% rename from server/controller/admin/admin.go rename to go/controller/admin/admin.go diff --git a/server/controller/category/category.go b/go/controller/category/category.go similarity index 100% rename from server/controller/category/category.go rename to go/controller/category/category.go diff --git a/server/controller/common/common.go b/go/controller/common/common.go similarity index 100% rename from server/controller/common/common.go rename to go/controller/common/common.go diff --git a/server/controller/order/order.go b/go/controller/order/order.go similarity index 100% rename from server/controller/order/order.go rename to go/controller/order/order.go diff --git a/server/controller/product/product.go b/go/controller/product/product.go similarity index 100% rename from server/controller/product/product.go rename to go/controller/product/product.go diff --git a/server/controller/user/user.go b/go/controller/user/user.go similarity index 100% rename from server/controller/user/user.go rename to go/controller/user/user.go diff --git a/server/helpers/helpers.go b/go/helpers/helpers.go similarity index 100% rename from server/helpers/helpers.go rename to go/helpers/helpers.go diff --git a/server/model/category.go b/go/model/category.go similarity index 100% rename from server/model/category.go rename to go/model/category.go diff --git a/server/model/errorcode.go b/go/model/errorcode.go similarity index 100% rename from server/model/errorcode.go rename to go/model/errorcode.go diff --git a/server/model/order.go b/go/model/order.go similarity index 100% rename from server/model/order.go rename to go/model/order.go diff --git a/server/model/product.go b/go/model/product.go similarity index 100% rename from server/model/product.go rename to go/model/product.go diff --git a/server/model/user.go b/go/model/user.go similarity index 100% rename from server/model/user.go rename to go/model/user.go diff --git a/server/utils/utils.go b/go/utils/utils.go similarity index 100% rename from server/utils/utils.go rename to go/utils/utils.go diff --git a/nginx/wemall.shen100.conf b/nginx/wemall.shen100.conf index 8dd1ed3f..a5d5e0f1 100644 --- a/nginx/wemall.shen100.conf +++ b/nginx/wemall.shen100.conf @@ -1,4 +1,4 @@ -upstream wemallApp { +upstream wemallNodejs { server 127.0.0.1:8010; } @@ -6,6 +6,10 @@ upstream wemallStaticServ { server 127.0.0.1:8011; } +upstream wemallApp { + server 127.0.0.1:8012; +} + server { listen 80; server_name wemall.shen100.com; @@ -20,6 +24,13 @@ server { #root /root/nowamagic_venv/nowamagic_pj; location / { + proxy_pass http://wemallNodejs; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /api { proxy_pass http://wemallApp; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; diff --git a/.babelrc b/nodejs/.babelrc similarity index 100% rename from .babelrc rename to nodejs/.babelrc diff --git a/nodejs/config/index.js b/nodejs/config/index.js index 7aeb3437..c3dd60f2 100644 --- a/nodejs/config/index.js +++ b/nodejs/config/index.js @@ -9,6 +9,7 @@ var config = { env : configData.nodejs.env, useProxy : configData.nodejs.useProxy, port : configData.nodejs.port, + staticPort : configData.nodejs.staticPort, page: { title : configData.nodejs.page.title, sitePath : configData.nodejs.page.sitePath, @@ -40,3 +41,5 @@ var config = { } } }()) + +module.exports = config; diff --git a/nodejs/helpers/index.js b/nodejs/helpers/index.js new file mode 100644 index 00000000..ffa0faa9 --- /dev/null +++ b/nodejs/helpers/index.js @@ -0,0 +1,8 @@ +var helpers = { + json: function(data) { + data = data || {}; + return JSON.stringify(data); + } +}; + +module.exports = helpers; \ No newline at end of file diff --git a/static/images/account-filling.png b/nodejs/static/images/account-filling.png similarity index 100% rename from static/images/account-filling.png rename to nodejs/static/images/account-filling.png diff --git a/static/images/cart.png b/nodejs/static/images/cart.png similarity index 100% rename from static/images/cart.png rename to nodejs/static/images/cart.png diff --git a/static/images/dollar.png b/nodejs/static/images/dollar.png similarity index 100% rename from static/images/dollar.png rename to nodejs/static/images/dollar.png diff --git a/static/images/trade.png b/nodejs/static/images/trade.png similarity index 100% rename from static/images/trade.png rename to nodejs/static/images/trade.png diff --git a/static/javascripts/admin/actions/requestSystemIndex.js b/nodejs/static/javascripts/admin/actions/requestSystemIndex.js similarity index 100% rename from static/javascripts/admin/actions/requestSystemIndex.js rename to nodejs/static/javascripts/admin/actions/requestSystemIndex.js diff --git a/static/javascripts/admin/actions/requestUserAnalyze.js b/nodejs/static/javascripts/admin/actions/requestUserAnalyze.js similarity index 100% rename from static/javascripts/admin/actions/requestUserAnalyze.js rename to nodejs/static/javascripts/admin/actions/requestUserAnalyze.js diff --git a/static/javascripts/admin/app.js b/nodejs/static/javascripts/admin/app.js similarity index 100% rename from static/javascripts/admin/app.js rename to nodejs/static/javascripts/admin/app.js diff --git a/static/javascripts/admin/components/HeaderNavbar.js b/nodejs/static/javascripts/admin/components/HeaderNavbar.js similarity index 100% rename from static/javascripts/admin/components/HeaderNavbar.js rename to nodejs/static/javascripts/admin/components/HeaderNavbar.js diff --git a/static/javascripts/admin/components/Sidebar.js b/nodejs/static/javascripts/admin/components/Sidebar.js similarity index 100% rename from static/javascripts/admin/components/Sidebar.js rename to nodejs/static/javascripts/admin/components/Sidebar.js diff --git a/static/javascripts/admin/config/index.js b/nodejs/static/javascripts/admin/config/index.js similarity index 100% rename from static/javascripts/admin/config/index.js rename to nodejs/static/javascripts/admin/config/index.js diff --git a/static/javascripts/admin/constants/index.js b/nodejs/static/javascripts/admin/constants/index.js similarity index 100% rename from static/javascripts/admin/constants/index.js rename to nodejs/static/javascripts/admin/constants/index.js diff --git a/static/javascripts/admin/containers/App.js b/nodejs/static/javascripts/admin/containers/App.js similarity index 100% rename from static/javascripts/admin/containers/App.js rename to nodejs/static/javascripts/admin/containers/App.js diff --git a/static/javascripts/admin/containers/Index.js b/nodejs/static/javascripts/admin/containers/Index.js similarity index 100% rename from static/javascripts/admin/containers/Index.js rename to nodejs/static/javascripts/admin/containers/Index.js diff --git a/static/javascripts/admin/containers/NotFound.js b/nodejs/static/javascripts/admin/containers/NotFound.js similarity index 100% rename from static/javascripts/admin/containers/NotFound.js rename to nodejs/static/javascripts/admin/containers/NotFound.js diff --git a/static/javascripts/admin/containers/OrderAnalyze.js b/nodejs/static/javascripts/admin/containers/OrderAnalyze.js similarity index 100% rename from static/javascripts/admin/containers/OrderAnalyze.js rename to nodejs/static/javascripts/admin/containers/OrderAnalyze.js diff --git a/static/javascripts/admin/containers/UserAnalyze.js b/nodejs/static/javascripts/admin/containers/UserAnalyze.js similarity index 100% rename from static/javascripts/admin/containers/UserAnalyze.js rename to nodejs/static/javascripts/admin/containers/UserAnalyze.js diff --git a/static/javascripts/admin/reducers/index.js b/nodejs/static/javascripts/admin/reducers/index.js similarity index 100% rename from static/javascripts/admin/reducers/index.js rename to nodejs/static/javascripts/admin/reducers/index.js diff --git a/static/javascripts/admin/reducers/systemIndex.js b/nodejs/static/javascripts/admin/reducers/systemIndex.js similarity index 100% rename from static/javascripts/admin/reducers/systemIndex.js rename to nodejs/static/javascripts/admin/reducers/systemIndex.js diff --git a/static/javascripts/admin/reducers/userAnalyze.js b/nodejs/static/javascripts/admin/reducers/userAnalyze.js similarity index 100% rename from static/javascripts/admin/reducers/userAnalyze.js rename to nodejs/static/javascripts/admin/reducers/userAnalyze.js diff --git a/static/javascripts/admin/route/index.js b/nodejs/static/javascripts/admin/route/index.js similarity index 100% rename from static/javascripts/admin/route/index.js rename to nodejs/static/javascripts/admin/route/index.js diff --git a/static/javascripts/admin/utils/index.js b/nodejs/static/javascripts/admin/utils/index.js similarity index 100% rename from static/javascripts/admin/utils/index.js rename to nodejs/static/javascripts/admin/utils/index.js diff --git a/static/javascripts/libs/echarts.js b/nodejs/static/javascripts/libs/echarts.js similarity index 100% rename from static/javascripts/libs/echarts.js rename to nodejs/static/javascripts/libs/echarts.js diff --git a/static/javascripts/libs/jquery.min.js b/nodejs/static/javascripts/libs/jquery.min.js similarity index 100% rename from static/javascripts/libs/jquery.min.js rename to nodejs/static/javascripts/libs/jquery.min.js diff --git a/static/styles/admin/app.css b/nodejs/static/styles/admin/app.css similarity index 100% rename from static/styles/admin/app.css rename to nodejs/static/styles/admin/app.css diff --git a/static/styles/admin/index.css b/nodejs/static/styles/admin/index.css similarity index 100% rename from static/styles/admin/index.css rename to nodejs/static/styles/admin/index.css diff --git a/staticServ.js b/nodejs/staticServ.js similarity index 89% rename from staticServ.js rename to nodejs/staticServ.js index b0693c1d..0f233063 100755 --- a/staticServ.js +++ b/nodejs/staticServ.js @@ -10,7 +10,7 @@ var webpack = require('webpack'); var webpackDevMiddleware = require('webpack-dev-middleware'); var webpackHotMiddleware = require('webpack-hot-middleware'); var webpackConfig = require('./webpack.config'); -var appConfig = require('./appconfig'); +var config = require('./config'); var compiler = webpack(webpackConfig); var app = express(); @@ -52,6 +52,6 @@ app.use(function(err, req, res, next) { res.render('error'); }); -server.listen(appConfig.server.StaticPort, function() { - console.log('StaticServ running at ' + appConfig.server.URL); +server.listen(config.staticPort, function() { + console.log('StaticServ running at :' + config.staticPort); }); diff --git a/nodejs/utils/index.js b/nodejs/utils/index.js index 11470e0a..80ba3a16 100644 --- a/nodejs/utils/index.js +++ b/nodejs/utils/index.js @@ -31,9 +31,7 @@ var EnvUtil = { errors = errors.join('\n '); console.error('\x1B[31mERROR: ' + packages.name + ' is unable to start due to missing dependencies:\x1B[0m\n ' + errors); console.error('\x1B[32m\nPlease run `npm install` and try starting ' + packages.name + ' again.'); - var github = config.docs.github; - var docStr = '\x1B[32mHelp and documentation can be found at ${github}\x1B[0m\n'; - console.error(docStr); + console.error('\x1B[32mHelp and documentation can be found at ' + config.docs.github + '\x1B[0m\n'); return false; } }; diff --git a/nodejs/webpack.config.js b/nodejs/webpack.config.js index 567fe35c..0342e58b 100755 --- a/nodejs/webpack.config.js +++ b/nodejs/webpack.config.js @@ -7,14 +7,18 @@ var config = require('./config'); var hotMiddleware = 'webpack-hot-middleware/client?reload=true'; var jsPath = config.page.jsPath; +console.log(123456); + + function getEntryMap() { var entryArr = [ 'admin/app' ]; var entryMap = {}; entryArr.forEach(function(key) { - entryMap[key] = ['babel-polyfill', '../static/javascripts/' + key + '.js', hotMiddleware]; + entryMap[key] = ['babel-polyfill', './static/javascripts/' + key + '.js', hotMiddleware]; }); + entryMap['vendor'] = [ 'react', 'react-dom', @@ -27,10 +31,10 @@ function getEntryMap() { var config = { entry: getEntryMap(), output: { - publicPath : config.page.sitePath + '/', - filename : '.' + jsPath + '/[name].js', + publicPath : '/', + filename : './javascripts/[name].js', path : path.resolve(__dirname, './dist/app/client'), - chunkFilename : '.' + jsPath + '/[name].js', + chunkFilename : './javascripts/[name].js' }, module: { loaders: [ @@ -52,7 +56,7 @@ var config = { plugins: [ new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', - filename: '.' + jsPath + '/vendor.bundle.js' + filename: './javascripts/vendor.bundle.js' }), new BellOnBundlerErrorPlugin(), new webpack.optimize.OccurrenceOrderPlugin(), diff --git a/server/views/404.hbs b/server/views/404.hbs deleted file mode 100644 index 990b1f5b..00000000 --- a/server/views/404.hbs +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - {{title}}-404 - - - -
404
- - \ No newline at end of file diff --git a/server/views/admin/index.hbs b/server/views/admin/index.hbs deleted file mode 100644 index 9dc89036..00000000 --- a/server/views/admin/index.hbs +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - {{title}}-后台管理 - - - -
- - - - - - - \ No newline at end of file diff --git a/server/views/error.hbs b/server/views/error.hbs deleted file mode 100644 index 99d870bd..00000000 --- a/server/views/error.hbs +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - {{title}}-出错啦 - - - -
{{error.message}}
-
{{error.status}}
-
{{error.stack}}
- - \ No newline at end of file