4.0.0 • Published 4 months ago
@cplabs/shield-server v4.0.0
Shield Server
Shield Server is a express middlewares bundle, which could help developer to bootstrap a backend project in few minutes.
The features provided by Shield Server
- Cross-Origin Resource Sharing (CORS)
- Compression
- History API
- JSend (JSON Response Specification)
- Reverse Proxy
- HTTP Header Security
- Splunk Logger (HEC - HTTP Event Collector)
- Error Handlers
Top features are powered by following popular middlewares:
- body-parser
- compression
- connect-history-api-fallback
- cookie-parser
- cors
- helmet
- http-proxy-middleware
- morgan
Getting Started
Installation
npm install @cplabs/shield-server
# or use yarn
yarn add @cplabs/shield-server
Usage
Codeless mode
# Default
shield-server .
Codeless CLI Configuration
- --port
- --cors
- --debug
- --history-api-fallback
- --ssl-cert
- --ssl-key
Middleware mode
const express = require('express');
const {
defaultMiddlewares,
defaultErrorHandlers,
logger,
} = require('@cplabs/shield-server');
const app = express();
app.use(defaultMiddlewares());
app.use(defaultErrorHandlers());
app.listen(8080, () => {
logger.info(`Server start...`);
});
Configuration
Default configs
Options
name
type String
The application name
compression
cors
corsOption
mode
static
api
fullstack
morganFormat
combined
common
dev
short
tiny
port
type int
default 8080
debug
type boolean
default false
ssl
splunk
splunk.httpRequest
splunk.
staticDir
publicPath
proxies
rewrite
historyApiFallback
helmetOption
loggerLevel
requestBodySize
4.0.0
4 months ago
3.0.0
12 months ago
2.0.0
1 year ago
1.0.1
2 years ago
1.0.0
2 years ago
0.2.3
3 years ago
0.1.0
3 years ago
0.2.1
3 years ago
0.2.0
3 years ago
0.2.2
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago
0.0.4
3 years ago
0.0.3-rc.8
3 years ago
0.0.3-rc.7
3 years ago
0.0.3-rc.6
3 years ago
0.0.3-rc.5
3 years ago
0.0.3-rc.4
3 years ago
0.0.3-rc.2
3 years ago
0.0.3-rc.3
3 years ago
0.0.3-rc.1
3 years ago
0.0.1
3 years ago
0.0.2
3 years ago
0.0.1-alpha-20201124
3 years ago
0.0.1-alpha-20201123
3 years ago
0.0.1-alpha
4 years ago