0.0.12 • Published 9 years ago

difficult-http-server v0.0.12

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

DifficultHttpServer NPM version Build Status Coverage Status

Instant HTTP Server for Single Page Application

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

Awesome converters

See also

License

MIT

0.0.12

9 years ago

0.0.12-alpha

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago

0.0.1-alpha

9 years ago

0.0.0

9 years ago