server.js 339 B

123456789101112
  1. 'use strict';
  2. const http = require('http');
  3. const nodeStatic = require('node-static');
  4. module.exports = () => {
  5. const fileServer = new nodeStatic.Server('./mock', {cache: false});
  6. http.createServer((request, response) => {
  7. request.addListener('end', () => {
  8. fileServer.serve(request, response);
  9. }).resume();
  10. }).listen(8080);
  11. };