UNPKG

3.01 kBMarkdownView Raw
1# volebo-express
2
3[![Build Status](https://travis-ci.org/volebo/volebo-express.svg?branch=master)](https://travis-ci.org/volebo/volebo-express)
4[![codecov](https://codecov.io/gh/volebo/volebo-express/branch/master/graph/badge.svg)](https://codecov.io/gh/volebo/volebo-express)
5[![bitHound Overall Score](https://www.bithound.io/github/volebo/volebo-express/badges/score.svg)](https://www.bithound.io/github/volebo/volebo-express)
6[![bitHound Dependencies](https://www.bithound.io/github/volebo/volebo-express/badges/dependencies.svg)](https://www.bithound.io/github/volebo/volebo-express/master/dependencies/npm)
7[![npm version](https://img.shields.io/npm/v/@volebo/volebo-express.svg)](https://www.npmjs.com/package/@volebo/volebo-express)
8[![npm downloads](https://img.shields.io/npm/dm/@volebo/volebo-express.svg)](https://www.npmjs.com/package/@volebo/volebo-express)
9
10Express JS server for Volebo.Net
11
12## Usage
13
14First, use this project as a dependency for your project. Right now there is a lot of tiny fixes in the source code, so the best way - use `npm link`, not `npm install`.
15
16Then, just follow this sample:
17
18```javascript
19"use strict";
20
21// require the module:
22const vbexpress = require('@volebo/volebo-express');
23
24// create an instance with appropriate options:
25var app = vbexpress( { "options" : "your options here"} );
26
27// Add routes:
28var routes = require('./routes/index');
29app.use('/', routes);
30
31// start handling
32app.start();
33```
34
35## Features
36
37* [`lang`][express-mw-lang] middleware enabled
38* `passport` enabled
39
40## Additional properties
41
42#### `app.config`
43
44Custom configuration of the server. It contains our own crutches and fixes.
45
46#### `app.hbs`
47
48Handlebars engine
49
50#### `app.lang`
51
52Express router, created by the [`express-mw-lang`][express-mw-lang] module.
53
54### Request and Response
55
56This module extends standart `req` and `res` with additional fields. Also, this module is sensitive to several fields of the `req` and `res`.
57
58#### `res.helpers`
59
60This object will be used as **per-request** HBS-helpers (see [this documentation][express-hbs-helpers] for additional details).
61
62The main purpose: set **locale** for handling current request with client's locale settings.
63
64#### `res.locals.lang`
65
66The extensions for res.locals, generated by the [express-mw-lang] module.
67
68#### `req.lang`
69
70See [`res.locals.lang`](#res-locals-lang)
71
72#### `req.forwardedSecure`
73
74Describes, whether the frontend server currently handles HTTPS query (after proxifying it becomes HTTP).
75
76## Credits
77
78All thanks and praises goes to:
79
80* [ExpressJS](http://expressjs.com) and many contributors of the [ExpressJS org](https://github.com/expressjs)
81* [Express Handlebars](https://github.com/ericf/express-handlebars)
82* [PassportJS](http://passportjs.org/) and Jared Hanson
83
84## License
85
86Please, follow the link: [LICENSE](https://github.com/volebo/volebo-express/raw/master/LICENSE)
87
88[express-mw-lang]: ../../../express-mw-lang
89[express-hbs-helpers]: https://www.npmjs.com/package/express-handlebars#helpers-1