2.2.0 • Published 7 months ago
@krknet/http-server v2.2.0
HTTP-Server
Wrapper around Express
Usage
const HTTPserver = require('@krknet/http-server')
const httpServer = new HTTPserver({
port: 8080,
ApiRouter: require('./api'),
PagesRouter: require('./frontend')
})
await httpServer.start()
await httpServer.stop()
const router = new HTTPserver.Router()
Options
{
port: 8080, // Port - required
host: '127.0.0.1', // Host - optionaö
ApiRouter, // ApiRouter Class - required
PagesRouter, // PagesRouter Class
loadingPage: null, // Path to the Page Displayed during Initializing
sentryRequests: null, // Sentry HTTP Request Handler
sentryErrors: null, // Sentry HTTP Error Handler
doTrustProxy: false, // enable('trust proxy')
doLogAPI: false, // Morgen Request Logger for API Endpoints
doLogFrontend: false, // Morgen Request Logger for Frontend Endpoints
bodyParserOptions: {}, // Options for BodyParser
helmetOptions: { contentSecurityPolicy: false }, // Options for Helmet
onStart: async () => null, // Executed and waited for an Start
initialMiddlewares: [], // Middlewares before all Parsers { route: '/', handler: (req, res, next) => next() },
middlewares: [], // Middlewares { route: '/', handler: (req, res, next) => next() },
statics: [] // Static Endpoints { route: '/static/', path: path.join(global.__basePath, 'static') }
}
Functions
async start ()
get rawServer ()
async stop ()
2.2.0
7 months ago
2.1.0
8 months ago
1.6.4
1 year ago
1.6.5
1 year ago
2.0.0
1 year ago
1.6.3
2 years ago
1.6.2
2 years ago
1.6.1
2 years ago
1.6.0
2 years ago
1.5.3
3 years ago
1.5.2
3 years ago
1.5.1
3 years ago
1.5.0
3 years ago
1.4.2
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.3.1
3 years ago
1.3.0
3 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago