├── bin.js ├── index.js ├── .editorconfig ├── .gitignore ├── LICENSE.md ├── HISTORY.md ├── package.json └── README.md /bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var dir, port 3 | 4 | process.argv.slice(2).forEach(function (arg) { 5 | var num = Number(arg) 6 | if (isNaN(num)) { 7 | dir = arg 8 | } 9 | else { 10 | port = num 11 | } 12 | }) 13 | 14 | 15 | require('./')(dir, port) -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var serve = require('serve') 2 | var path = require('path') 3 | module.exports = function (dir, port) { 4 | serve( 5 | path.resolve(process.cwd(), dir || '.'), 6 | { 7 | port: port || 3000, 8 | ignore: ['node_modules'] 9 | } 10 | ) 11 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # 2018 January 24 2 | # https://github.com/bevry/base 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = false 11 | indent_style = tab 12 | 13 | [{*.mk,*.py}] 14 | indent_style = tab 15 | indent_size = 4 16 | 17 | [*.md] 18 | indent_style = space 19 | indent_size = 4 20 | 21 | [{*.json,*.yml,*.bowerrc,*.babelrc}] 22 | indent_style = space 23 | indent_size = 2 24 | 25 | [*.json] 26 | insert_final_newline = true 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2017 April 12 2 | # https://github.com/bevry/base 3 | 4 | # System Files 5 | **/.DS_Store 6 | 7 | # Temp Files 8 | yarn.lock 9 | **/.docpad.db 10 | **/out.* 11 | **/*.log 12 | **/*.cpuprofile 13 | **/*.heapsnapshot 14 | 15 | # Build Files 16 | build/ 17 | components/ 18 | bower_components/ 19 | node_modules/ 20 | out/ 21 | *output/ 22 | coffeejs/ 23 | coffee/ 24 | es5/ 25 | es2015/ 26 | esnext/ 27 | docs/ 28 | 29 | # Editor Caches 30 | .c9/ 31 | .vscode/ 32 | 33 | # Private Files 34 | .env 35 | .idea 36 | .cake_task_cache 37 | 38 | 39 | # ===================================== 40 | # CUSTOM 41 | 42 | # None 43 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

License

4 | 5 | Unless stated otherwise all works are: 6 | 7 | 8 | 9 | and licensed under: 10 | 11 | 12 | 13 |

MIT License

14 | 15 |
16 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
17 | 
18 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
19 | 
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 | 
22 | 23 | 24 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | # History 2 | 3 | ## v1.1.1 2018 January 30 4 | - Syntax highlighting in readme 5 | 6 | ## v1.1.0 2018 January 30 7 | - Now just an alias for [zeit/serve](https://github.com/zeit/serve) as that is actually maintained 8 | - Minimum supported node version changed from 0.4 to 6 9 | - Fixed parsing of arguments, can now be in any order 10 | 11 | ## v1.0.1 2013 October 23 12 | - Accepts arguments in any order now 13 | - Removed coffee-script dependency 14 | - Project meta data files are now maintained with [Projectz](https://github.com/bevry/projectz) 15 | 16 | ## v1.0.0 2012 February 11 17 | - Removed [Less4Clients](https://github.com/balupton/less4clients.npm) and [Coffee4Clients](https://github.com/balupton/coffee4clients.npm) as they should be using [DocPad](http://github.com/balupton/docpad) instead if they want that 18 | - Moved History into `History.md` 19 | - Added local copy of the license to `LICENSE.txt` 20 | - Now dones a console log of the directory it's serving, and the url it's serving to 21 | - Working with node.js 0.6 22 | 23 | ## v0.4 2011 July 5 24 | - Added [Less4Clients](https://github.com/balupton/less4clients.npm) 25 | 26 | ## v0.3 2011 June 30 27 | - Added directory listings 28 | 29 | ## v0.2 2011 June 29 30 | - Added [Coffee4Clients](https://github.com/balupton/coffee4clients.npm) v0.2 31 | - CoffeeScript files accessed with the querystring `?js` are compiled server-side 32 | 33 | ## v0.1 2011 June 3 34 | - Initial commit 35 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Simple Server", 3 | "name": "simple-server", 4 | "version": "1.1.1", 5 | "description": "Simple Server allows you to easily get a node.js static file server up and running anywhere anytime.", 6 | "homepage": "https://github.com/balupton/simple-server", 7 | "license": "MIT", 8 | "keywords": [ 9 | "server", 10 | "simple" 11 | ], 12 | "badges": { 13 | "list": [ 14 | "travisci", 15 | "npmversion", 16 | "npmdownloads", 17 | "daviddm", 18 | "daviddmdev", 19 | "---", 20 | "patreon", 21 | "opencollective", 22 | "gratipay", 23 | "flattr", 24 | "paypal", 25 | "bitcoin", 26 | "wishlist", 27 | "---", 28 | "slackin" 29 | ], 30 | "config": { 31 | "patreonUsername": "bevry", 32 | "opencollectiveUsername": "bevry", 33 | "gratipayUsername": "bevry", 34 | "flattrUsername": "balupton", 35 | "paypalURL": "https://bevry.me/paypal", 36 | "bitcoinURL": "https://bevry.me/bitcoin", 37 | "wishlistURL": "https://bevry.me/wishlist", 38 | "slackinURL": "https://slack.bevry.me" 39 | } 40 | }, 41 | "author": "2011+ Benjamin Lupton (http://balupton.com)", 42 | "maintainers": [ 43 | "Benjamin Lupton (http://balupton.com)" 44 | ], 45 | "contributors": [ 46 | "Benjamin Lupton (http://balupton.com)", 47 | "Darrick Brown (https://github.com/voidstardb)" 48 | ], 49 | "bugs": { 50 | "url": "https://github.com/balupton/simple-server/issues" 51 | }, 52 | "repository": { 53 | "type": "git", 54 | "url": "https://github.com/balupton/simple-server.git" 55 | }, 56 | "engines": { 57 | "node": ">=6" 58 | }, 59 | "preferGlobal": true, 60 | "bin": "bin.js", 61 | "main": "index.js", 62 | "dependencies": { 63 | "serve": "^6.4.9" 64 | }, 65 | "devDependencies": { 66 | "projectz": "^1.4.0" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Simple Server

4 | 5 | 6 | 7 | 8 | 9 | 10 | Travis CI Build Status 11 | NPM version 12 | NPM downloads 13 | Dependency Status 14 | Dev Dependency Status 15 |
16 | Patreon donate button 17 | Open Collective donate button 18 | Gratipay donate button 19 | Flattr donate button 20 | PayPal donate button 21 | Bitcoin donate button 22 | Wishlist browse button 23 |
24 | Slack community badge 25 | 26 | 27 | 28 | 29 | 30 | 31 | Simple Server allows you to easily get a node.js static file server up and running anywhere anytime. 32 | 33 | 34 | 35 | 36 | 37 | 38 |

Install

39 | 40 |

NPM

    41 |
  • Install: npm install --global simple-server
  • 42 |
  • Executable: simple-server
43 | 44 | 45 | 46 | 47 | ## Using 48 | 49 | Module usage is as so: 50 | 51 | ``` javascript 52 | require('simple-server')(dir, port) 53 | ``` 54 | 55 | Command line usage is as so: 56 | 57 | ``` bash 58 | npm i -g simple-server 59 | simple-server public 3000 60 | ``` 61 | 62 | Number argument is the port. String argument is the directory. No directory will listen to the current directory. No port will listen on port `3000`. 63 | 64 | As of v1.1.0 this project is now just a quick alias for [zeit/serve](https://github.com/zeit/serve), which you should just use directly, as that project is maintained and this project is not. If you have python on your computer, you can also just use: 65 | 66 | ``` bash 67 | python -m SimpleHTTPServer 8000 68 | ``` 69 | 70 | 71 | 72 | 73 |

History

74 | 75 | Discover the release history by heading on over to the HISTORY.md file. 76 | 77 | 78 | 79 | 80 | 81 | 82 |

Backers

83 | 84 |

Maintainers

85 | 86 | These amazing people are maintaining this project: 87 | 88 | 89 | 90 |

Sponsors

91 | 92 | No sponsors yet! Will you be the first? 93 | 94 | Patreon donate button 95 | Open Collective donate button 96 | Gratipay donate button 97 | Flattr donate button 98 | PayPal donate button 99 | Bitcoin donate button 100 | Wishlist browse button 101 | 102 |

Contributors

103 | 104 | These amazing people have contributed code to this project: 105 | 106 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 |

License

117 | 118 | Unless stated otherwise all works are: 119 | 120 | 121 | 122 | and licensed under: 123 | 124 | 125 | 126 | 127 | --------------------------------------------------------------------------------