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.

89 lines
2.3 KiB

11 years ago
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
11 years ago
11 years ago
12 years ago
12 years ago
12 years ago
11 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
11 years ago
11 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. A pure Javascript (and more reliable) alternative to `$ python -mSimpleHTTPServer 8000`.
  7. Use for local web development or file sharing (directory browsing enabled). Plays well with Google Chrome Workspaces.
  8. Install
  9. -------
  10. Install [Node.js](http://nodejs.org), then run
  11. ```sh
  12. $ npm install -g local-web-server
  13. ```
  14. *Linux/Mac users may need to run the above with `sudo`*
  15. Usage
  16. -----
  17. ```
  18. usage: ws [--directory|-d <directory>] [--port|-p <port>] [--log-format|-f dev|default|short|tiny]
  19. ```
  20. From the folder you wish to serve, run:
  21. ```sh
  22. $ ws
  23. serving at http://localhost:8000
  24. ```
  25. If you wish to serve a different directory, run:
  26. ```sh
  27. $ ws -d ~/mysite/
  28. serving ~/mysite at http://localhost:8000
  29. ```
  30. If you wish to override the default port (8000), use `--port` or `-p`:
  31. ```sh
  32. $ ws --port 9000
  33. serving at http://localhost:9000
  34. ```
  35. Use a built-in or custom [Connect logger format](http://www.senchalabs.org/connect/logger.html) with `--log-format`:
  36. ```sh
  37. $ ws --log-format short
  38. ```
  39. Use with Logstalgia
  40. -------------------
  41. The "default" log-format is compatible with [logstalgia](http://code.google.com/p/logstalgia/).
  42. If you wrote your log output to disk, like so:
  43. ```sh
  44. $ ws --log-format default > web.log
  45. ```
  46. Then you could visualise in logstalgia with:
  47. ```sh
  48. $ logstalgia web.log
  49. ```
  50. Alternatively, pipe directly from ws into logstalgia for real-time visualisation:
  51. ```sh
  52. $ ws --log-format default | logstalgia -
  53. ```
  54. Use with glTail
  55. ---------------
  56. To use with [glTail](http://www.fudgie.org), write your log to disk using the "default" format:
  57. ```sh
  58. $ ws -f default > web.log
  59. ```
  60. Then specify this file in your glTail config:
  61. ```yaml
  62. servers:
  63. dev:
  64. host: localhost
  65. source: local
  66. files: /Users/Lloyd/Documents/MySite/web.log
  67. parser: apache
  68. color: 0.2, 0.2, 1.0, 1.0
  69. ```
  70. [![NPM](https://nodei.co/npm-dl/local-web-server.png?months=3)](https://nodei.co/npm/local-web-server/)