25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.1 KiB

3 년 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #Browsersync - Server + Logging + History API fallback middlewares Example
  2. ## Installation/Usage:
  3. To try this example, follow these 4 simple steps.
  4. **Step 1**: Clone this entire repo
  5. ```bash
  6. $ git clone https://github.com/Browsersync/recipes.git bs-recipes
  7. ```
  8. **Step 2**: Move into the directory containing this example
  9. ```bash
  10. $ cd bs-recipes/recipes/server.middleware
  11. ```
  12. **Step 3**: Install dependencies
  13. ```bash
  14. $ npm install
  15. ```
  16. **Step 4**: Run the example
  17. ```bash
  18. $ npm start
  19. ```
  20. ### Additional Info:
  21. This example adds the [connect-logger](https://www.npmjs.com/package/connect-logger) middleware
  22. ![Logger](http://f.cl.ly/items/3i2G451L3O3R182b3p14/Screen%20Shot%202015-02-18%20at%2016.02.59.png)
  23. ### Preview of `app.js`:
  24. ```js
  25. /**
  26. * Require Browsersync
  27. */
  28. var browserSync = require('browser-sync').create();
  29. var historyApiFallback = require('connect-history-api-fallback')
  30. /**
  31. * Run Browsersync with server config
  32. */
  33. browserSync.init({
  34. server: "app",
  35. files: ["app/*.html", "app/css/*.css"],
  36. middleware: [require("connect-logger")(), historyApiFallback()]
  37. });
  38. ```