supershit
I peace of awsomeshit which improves your live.
Last updated 2 years ago by andifeind .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install supershit 
SYNC missed versions from official npm registry.

Supershit

Lightweight search-engine friendly single-page web framework

Requirements

NodeJS >= 8

Installation

npm i supershit -g

How to use

REST API

Lets create a simple REST API in a few steps.

const api = supershit.api('/api')

api.route('/hello', {
  get() {
    return { message: 'Hello World!' }
  }
})

You'll find this example in examples/simple-api.js folder. Start the example by using the command node examples/simple-api.js and fire a curl to the API.

curl -X GET -H "accept: application/json" http://localhost:7448/api/hello

# Response
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Content-Length: 26
{"message":"Hello World!"}

Read more about the api() method at REST API page

Start a server

The default port is 7448. Supershit starts a webserver when it's required. Use the start command supershit start to start the app in clustermode or for development the dev command supershit dev, it reloads the app everytime when a source file changes.

Refer to CLI page to get a list of all supported commands.

Config

Supershit reads config from config/${process.env.NODE_ENV}.json. A config file can be either a .json, .cson or .yaml file.

// load config from config files
const config = supershit.config()

Read more about config at the Config page.

Logging

const log = supershit.logger()
log.info('App started successful,', {
  port: 7448
})

log.debug('Process id:,', process.pid)

Read more about logging at the Logging page.

Current Tags

  • 0.5.5                                ...           latest (2 years ago)

17 Versions

  • 0.5.5                                ...           2 years ago
  • 0.5.4                                ...           2 years ago
  • 0.5.3                                ...           2 years ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.1                                ...           2 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.0                                ...           3 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (18)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |