浏览代码

贷款-新增node服务

panyong 4 年之前
父节点
当前提交
4898b06f69
共有 3 个文件被更改,包括 19 次插入0 次删除
  1. 2 0
      htmldev/loan/README.md
  2. 2 0
      htmldev/loan/package.json
  3. 15 0
      htmldev/loan/server.js

+ 2 - 0
htmldev/loan/README.md

@@ -22,3 +22,5 @@ npm run lint
 
 ### Customize configuration
 See [Configuration Reference](https://cli.vuejs.org/config/).
+
+### http://daikuan.codedreamit.com/loan/apply/1

+ 2 - 0
htmldev/loan/package.json

@@ -22,9 +22,11 @@
     "babel-plugin-import": "^1.13.0",
     "better-scroll": "^2.0.4",
     "clipboard": "^2.0.6",
+    "connect-history-api-fallback": "^1.6.0",
     "cross-env": "^7.0.2",
     "eslint": "^6.7.2",
     "eslint-plugin-vue": "^6.2.2",
+    "express": "^4.17.1",
     "filemanager-webpack-plugin": "^2.0.5",
     "node-sass": "^4.14.1",
     "path": "^0.12.7",

+ 15 - 0
htmldev/loan/server.js

@@ -0,0 +1,15 @@
+const express = require('express')
+const history = require('connect-history-api-fallback')
+const app = express()
+const httpPort = 3000
+const middleware = history(
+  {
+    index: '/index.html'
+  }
+)
+
+app.use(middleware)
+app.use(express.static('dist'))
+app.listen(httpPort, () => {
+  console.log('Server listening on: http://localhost:%s', httpPort)
+})