This package has been deprecated

Author message:

Use https://github.com/tkesgar/sharo instead

@tkesgar/sharo

0.0.6 • Public • Published

sharo

XO code style

sharo creates an Express app with batteries included.

I created this for easy maintenance of my Node apps; just a single package to upgrade across all apps.

If you want a full-blown boilerplate with additional stuff, check simply-boilerplate.

Installation

Add sharo into dependencies:

$ npm i sharo

Usage

API

createApp([config])

Given a sharo configuration object, generates an Express app according to the configuration.

generateWebpackConfig([config])

Given a sharo configuration object, generates a Webpack configuration object according to the configuration.

Useful if you want to trigger Webpack build by yourself or use the configuration as part of other build tool, for example:

// webpack.config.js

const {generateWebpackConfig} = require('@tkesgar/sharo')

module.exports = generateWebpackConfig(sharoConfig)

// This way you can run 'webpack -p' in shell.

createRouter([options])

Alias to express.Router() function from express package.

Useful to create routes:

// routes/hello.js

const {createRouter} = require('@tkesgar/sharo')

const router = createRouter()

router.get('/hello', (req, res) => res.send('Hello world!'))

module.exports = router

bunyanSerializers

Alias to bunyan.stdSerializers array from bunyan package.

Useful to provide serializers in sharo configuration:

// sharo.config.js
const {bunyanSerializers} = require('@tkesgar/sharo')

module.exports = {
  // ...
  'app-log.serializers': [
    ...bunyanSerializers,
    ...customSerializers
  ]
  // ...
}

The module exports a single function that receives a configuration object and returns the Express app:

import sharo from 'sharo'

const app = sharo({/* sharo configuration */})

// Do stuff with app, e.g. create server for HTTP and HTTPS:
http.createServer(app).listen(80)
https.createServer(httpsOptions, app).listen(443)

CLI

sharo-build

Basically just runs Webpack build using the configuration provided by sharo.

sharo-start

Creates the Express app and starts it on PORT (defaults to 1507).

Configurations

TBD

See lib/normalize-config.js for a list of configurations available.

Sharo?

From Is the Order a Rabbit?.

Sharo drawn by 成海クリスティアーノート

License

Licensed under MIT License.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i @tkesgar/sharo

Weekly Downloads

7

Version

0.0.6

License

MIT

Unpacked Size

23.7 kB

Total Files

24

Last publish

Collaborators

  • tkesgar