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.

82 lines
2.0 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
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
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 serve a different directory, run:
  22. ```sh
  23. $ ws -d ~/mysite/
  24. ```
  25. If you wish to override the default port (8000), use `--port` or `-p`:
  26. ```sh
  27. $ ws --port 9000
  28. serving at http://localhost:9000
  29. ```
  30. Use a built-in or custom [Connect logger format](http://www.senchalabs.org/connect/logger.html) with `--log-format`:
  31. ```sh
  32. $ ws --log-format short
  33. ```
  34. Use with Logstalgia
  35. -------------------
  36. The "default" log-format is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
  37. If you wrote your log output to disk, like so:
  38. ```sh
  39. $ ws --log-format default > web.log
  40. ```
  41. Then you could visualise in logstalgia with:
  42. ```sh
  43. $ logstalgia web.log
  44. ```
  45. Alternatively, pipe directly from ws into logstalgia for real-time visualisation:
  46. ```sh
  47. $ ws --log-format default | logstalgia -
  48. ```
  49. Use with glTail
  50. ---------------
  51. To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
  52. ```sh
  53. $ ws -f default > web.log
  54. ```
  55. Then specify this file in your glTail config:
  56. ```yaml
  57. servers:
  58. dev:
  59. host: localhost
  60. source: local
  61. files: /Users/Lloyd/Documents/MySite/web.log
  62. parser: apache
  63. color: 0.2, 0.2, 1.0, 1.0
  64. ```
  65. [![NPM](https://nodei.co/npm-dl/local-web-server.png?months=3)](https://nodei.co/npm/local-web-server/)