/**
 * Babel Starter Kit (https://www.kriasoft.com/babel-starter-kit)
 *
 * Copyright © 2015-2016 Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

// import 'babel-polyfill';

import express from 'express';
import cors from 'cors';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import { host, port } from './config';
import shop from './shop';
import operator from './operator';
import custcardinfo from './custcardinfo';
import userdtl from './userdtl';

const app = express();

//
// Register Node.js middleware
// -----------------------------------------------------------------------------
app.use(cors());
app.use(cookieParser('my cookie key'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true }));
app.use(express.static('public'));

const morgan = require('morgan');
app.use(morgan('dev'));

/*
 注册API
 */
app.use('/shop', shop);
app.use('/operator', operator);
app.use('/custcardinfo', custcardinfo);
app.use('/userdtl', userdtl);

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

/*
 处理异常
 */
app.use(async (err, req, res, next) => {
  console.log(err);
  res.json({ret: err.status, data: err.message});
});

app.listen(port, () => {
  console.log(`The server is running at http://${host}/`);
});

//export YktManager from './YktManager.js';

@@ -426,24 +426,49 @@
 dy-parser';%0A
+import path from 'path';%0A
 import %7B hos
@@ -1016,17 +1016,54 @@
 .static(
-'
+path.resolve(path.join(__dirname, '../
 public')
@@ -1063,16 +1063,18 @@
 ublic'))
+))
 ;%0A%0Aconst
@@ -1272,98 +1272,8 @@
 );%0A%0A
-app.get('/', function (req, res) %7B%0A  res.sendfile(__dirname + '/public/index.html');%0A%7D);%0A%0A
 /*%0A 
@@ -1354,16 +1354,17 @@
 s.json(%7B
+ 
 ret: err
@@ -1389,16 +1389,17 @@
 .message
+ 
 %7D);%0A%7D);%0A
@@ -1488,18 +1488,19 @@
 );%0A%7D);%0A%0A
-
 //
+ 
 export Y

fix static serve path