@volebo/express

0.8.4 • Public • Published

@volebo/express

################################################################################
#                                                                              #
# db    db  .8888.  dP     888888b 8888ba   .8888.     d8b   db 888888b d8888P #
# 88    88 d8'  `8b 88     88      88  `8b d8'  `8b    88V8  88 88        88   #
# Y8    8P 88    88 88    a88aaa   88aa8P' 88    88    88 V8 88 88aaa     88   #
# `8b  d8' 88    88 88     88      88  `8b 88    88    88  V888 88        88   #
#  `8bd8'  Y8.  .8P 88     88      88  .88 Y8.  .8P dP 88   V88 88        88   #
#    YP     `888P'  88888P 888888P 888888'  `888P'  88 VP    8P 888888P   dP   #
#                                                                              #
################################################################################

Build Status codecov bitHound Overall Score bitHound Dependencies npm version npm downloads

https://codeclimate.com/github/volebo/volebo-express

Express JS server for Volebo.Net

Usage

First, use this project as a dependency for your project.

Since the codebase isn't mature (at any level), it is better to use npm link @volebo/express than npm install.

Then, just follow this sample:

'use strict'

// require the module:
const vbexpress       = require('@volebo/express')

const configPath = 'server/config.yaml'
const overrideOpts = {
	'debug': true
}

// create an instance with appropriate options:
const app = vbexpress(configPath, overrideOpts)

// Add routes (no lang-handler):
const routes = require('./routes')
app.use('/', routes)

// Add routes with language-culture detection:
const routesL10N = require('./routes2')
app.lang.use('/', routesL10N)

// start handling
app.start()

Additional properties

app.config

Custom configuration of the server. It contains our own crutches and fixes.

app.hbs

Handlebars engine with registered HBS-helpers by Assemble-team

app.lang

Express router, created by the express-mw-lang module.

app.log

Bunyan logger.

Request and Response

This module extends standard req and res with additional fields. Also, this module is sensitive to several fields of the req and res.

res.helpers

This object will be used as per-request HBS-helpers (see this documentation for additional details).

The main purpose: set locale for handling current request with client's locale settings.

res.locals.lang

The extensions for res.locals, generated by the express-mw-lang module.

res.locals.user

Information about logged-in user. User is authenticated (by PassportJS) and partially filtered (a few fields are accessible).

req.lang

See res.locals.lang

req.forwardedSecure

Describes, whether the front end server currently handles HTTPS query (after proxying it becomes HTTP).

Credits

All thanks and praises go to:

License

Please, follow the link: LICENSE

Package Sidebar

Install

npm i @volebo/express

Weekly Downloads

1

Version

0.8.4

License

GPL-3.0

Unpacked Size

98.6 kB

Total Files

21

Last publish

Collaborators

  • volebo