You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.9 KiB

11 years ago
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
12 years ago
11 years ago
11 years ago
  1. [![NPM version](https://badge.fury.io/js/local-web-server.png)](http://badge.fury.io/js/local-web-server)
  2. [![Dependency Status](https://david-dm.org/75lb/local-web-server.png)](https://david-dm.org/75lb/local-web-server)
  3. ![Analytics](https://ga-beacon.appspot.com/UA-27725889-12/local-web-server/README.md?pixel)
  4. local-web-server
  5. ================
  6. Fires up a simple, static web server on a given port. Use for local web development or file sharing (directory browsing enabled).
  7. Install
  8. -------
  9. Install [Node.js](http://nodejs.org), then run
  10. ```sh
  11. $ npm install -g local-web-server
  12. ```
  13. *Linux/Mac users may need to run the above with `sudo`*
  14. Usage
  15. -----
  16. From the folder you wish to serve, run:
  17. ```sh
  18. $ ws
  19. serving at http://localhost:8000
  20. ```
  21. If you wish to override the default port (8000), use `--port` or `-p`:
  22. ```sh
  23. $ ws --port 9000
  24. serving at http://localhost:9000
  25. ```
  26. Use a built-in or custom [Connect logger format](http://www.senchalabs.org/connect/middleware-logger.html) with `--log-format`:
  27. ```sh
  28. $ ws --log-format short
  29. ```
  30. Use with Logstalgia
  31. -------------------
  32. The "default" log-format is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
  33. If you wrote your log output to disk, like so:
  34. ```sh
  35. $ ws --log-format default > web.log
  36. ```
  37. Then you could visualise in logstalgia with:
  38. ```sh
  39. $ logstalgia web.log
  40. ```
  41. Alternatively, pipe directly from ws into logstalgia for real-time visualisation:
  42. ```sh
  43. $ ws --log-format default | logstalgia -
  44. ```
  45. Use with glTail
  46. ---------------
  47. To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
  48. ```sh
  49. $ ws -f default > web.log
  50. ```
  51. Then specify this file in your glTail config:
  52. ```yaml
  53. servers:
  54. dev:
  55. host: localhost
  56. source: local
  57. files: /Users/Lloyd/Documents/MySite/web.log
  58. parser: apache
  59. color: 0.2, 0.2, 1.0, 1.0
  60. ```
  61. [![NPM](https://nodei.co/npm-dl/local-web-server.png?months=3)](https://nodei.co/npm/local-web-server/)