app.js 430 B

1234567891011121314
  1. const fs = require('fs');
  2. const path = require('path');
  3. const express = require('express');
  4. const chalk = require('chalk')
  5. const app = express();
  6. app.use(express.static(path.resolve(__dirname, './dist')))
  7. app.get('*', function(req, res) {
  8. const html = fs.readFileSync(path.resolve(__dirname, './dist/index.html'), 'utf-8')
  9. res.send(html)
  10. })
  11. app.listen(8082, res => {
  12. console.log(chalk.yellow('Start Service On 8082'));
  13. });