0.0.12 • Published 10 years ago

difficult-http-server v0.0.12

Weekly downloads
5
License
MIT
Repository
github
Last release
10 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

10 years ago

0.0.12-alpha

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.1-alpha

10 years ago

0.0.0

10 years ago