DifficultHttpServer
Instant HTTP Server for Single Page Application
- static-server
- bower compressor
- single file compiler(coffee-reactify / jade / stylus)
Usage
npm install difficult-http-server --global # create empty project mkdir my-projectcd my-project # create empty files(requirement) dhs touchtree .# my-project # ├── index.coffee # ├── index.jade # └── index.styl # fetch packages(optional) npm install bower --globalbower init # or `echo '{"name":"'$(basename $PWD)'"}' > bower.json` bower install angular-ui-router --save # boot dhs . --open# DifficultHTTPServer at http://localhost:59798 using .
index.jade
doctype htmlhtml head meta(charset="UTF-8") title DifficultHTTPServer script(src="pkgs.js") script(src="index.js") link(href="index.css" rel="stylesheet") body h1 hello dhs
Other options
See also $ dhs
Routes
GET /
parse /index.jade
GET /index.js
parse /index.coffee
using coffee-reactify with ng-annotate + plain-jadeify + brfs
GET /index.css
parse /index.styl
with kouto-swiss
GET /pkgs.js
/ GET /pkgs.min.js
combine dependencies of /bower.json using express-onefile
Otherwise
to static serving. (If a static file exists, the middlewares will not be executed)
Getting started
React
mkdir gs-reactcd gs-react dhs touchtouch bower.jsontree . -L 1# . # ├── bower.json # ├── index.coffee # ├── index.jade # └── index.styl
bower.json
index.coffee
: -> super @state= message:'this is react' : -> <div onClick=@handleClick> <p>@statemessage</p> </div> : => @setState message:'awesome' addEventListener 'DOMContentLoaded'-> ReactDOMrender <Hello />documentquerySelector 'main'
index.jade
doctype htmlhtml head meta(charset="UTF-8") title DifficultHTTPServer script(src="pkgs.js") script(src="index.js") link(href="index.css" rel="stylesheet") body main
index.styl
// unused
bower install dhs . --open# DifficultHTTPServer at http://localhost:59798 using .
Example
- narou.berabou.me
http://syosetu.com/
Vertical Reader - vpd.berabou.me MikuMikuDance Vocaloid-Pose-Data(
.vpd
) Viewer - nicolive.berabou.me
http://live.nicovideo.jp/
Comment Viewer
Awesome converters
- js2coffee 2.0 — convert JavaScript to CoffeeScript by Rico Sta. Cruz
- HTML2Jade - HTML to Jade Online Realtime Converter by Don Park
- Css2Stylus - Convert your #CSS into #Stylus! by Denis Ciccale
See also
- express
- express-cjs (coffee-script / jade / stylus)
- express-onefile (bower / onefile)
- difficult-http-server