
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@skbkontur/node-core
Advanced tools
В библиотеке есть всё что вам надо:
Библиотека композирует модули и инициализирует компоненты.
Документация:
Внутри данного модуля реализован набор middleware для веб фреймворка koa2
.
Если вы используете другой фремворк, вам необходимо реализовать middleware для него.
Пример использования с koa2
:
const core = require('@skbkontur/node-core')
const auth = require('./src/middlewares/authentication')
const router = require('./src/middlewares/router')
const config = require('./src/config')
const Koa = require('koa')
const app = new Koa()
core.initClusterConfig(config.zone)
.then((clusterConfig) => core.runApp(config, clusterConfig))
.then(async function createApp(coreApp) {
const { logger } = coreApp
core.useCore(app, coreApp)
app.use(auth)
app.use(router())
app.listen(config.port, () => {
logger.info(`Application started at http://localhost:${config.port}`)
})
})
Ниже приведен список всех компонентов coreApp
.
Апи для их использования можно найти в соответствующих репозиториях:
https://www.npmjs.com/package/@skbkontur/cluster-config-client https://www.npmjs.com/package/@skbkontur/winston-kontur-logstash https://www.npmjs.com/package/@skbkontur/span-aggregator-client https://www.npmjs.com/package/@skbkontur/monitoring-client
const {
logger,
clusterConfig,
config,
monitor,
monitoringClient,
spanAggregator,
options
} = coreApp
Если вы используете middleware для koa2
из этого репозитория, то вы имеете доступ к компонентам coreApp из контекста koa
.
app.use((ctx) => {
ctx.core.logger.info('hello')
ctx.core.clusterConfig.getSettingsByPrefix('topology/graphite-prod/')
ctx.core.monitoringClient.send('metricName', 5)
})
FAQs
Основные компоненты для разработки на Node.js
The npm package @skbkontur/node-core receives a total of 0 weekly downloads. As such, @skbkontur/node-core popularity was classified as not popular.
We found that @skbkontur/node-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.