difficult-http-server
v0.0.12
Published
Instant HTTP Server for Single Page Application
Downloads
10
Maintainers
Readme
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-project
cd my-project
# create empty files(requirement)
dhs touch
tree .
# my-project
# ├── index.coffee
# ├── index.jade
# └── index.styl
# fetch packages(optional)
npm install bower --global
bower 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 html
html
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-react
cd gs-react
dhs touch
touch bower.json
tree . -L 1
# .
# ├── bower.json
# ├── index.coffee
# ├── index.jade
# └── index.styl
bower.json
{
"name": "gs-react",
"dependencies": {
"react": "~0.14.0"
},
"overrides": {
"react": {
"main": [
"react.js",
"react-dom.js"
]
}
}
}
index.coffee
class Hello extends React.Component
constructor: ->
super
@state= {message:'this is react'}
render: ->
<div onClick={@handleClick}>
<p>{@state.message}</p>
</div>
handleClick: =>
@setState {message:'awesome'}
addEventListener 'DOMContentLoaded',->
ReactDOM.render <Hello />,document.querySelector 'main'
index.jade
doctype html
html
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