app.js 421 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, './')))
  7. app.get('*', function(req, res) {
  8. const html = fs.readFileSync(path.resolve(__dirname, './index.html'), 'utf-8')
  9. res.send(html)
  10. })
  11. app.listen(5080, res => {
  12. console.log(chalk.yellow('Start Service On 5080'));
  13. });