Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added ru readme for landing #67

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions README-ru.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ExpressKit

`ExpressKit` — легковесная обертка для [express.js](https://expressjs.com/), которая интегрируется с [NodeKit](https://github.com/gravity-ui/nodekit), обеспечивая такие функции, как логирование запросов, поддержка трассировки, асинхронные контроллеры и middleware, а также детальное описание маршрутов.

Установка:

```bash
npm install --save @gravity-ui/nodekit @gravity-ui/expresskit
```

Основное использование:

```typescript
import {ExpressKit} from '@gravity-ui/expresskit';
import {NodeKit} from '@gravity-ui/nodekit';

const nodekit = new NodeKit();

const app = new ExpressKit(nodekit, {
'GET /': (req, res) => {
res.send('Hello World!');
},
});

app.run();
```

## CSP (политика безопасности контента)

`config.ts`

```typescript
import type {AppConfig} from '@gravity-ui/nodekit';
import {csp} from '@gravity-ui/expresskit';

const config: Partial<AppConfig> = {
expressCspEnable: true,
expressCspPresets: ({getDefaultPresets}) => {
return getDefaultPresets({defaultNone: true}).concat([
csp.inline(),
{csp.directives.REPORT_TO: 'my-report-group'},
]);
},
expressCspReportTo: [
{
group: 'my-report-group',
max_age: 30 * 60,
endpoints: [{ url: 'https://cspreport.com/send'}],
include_subdomains: true,
}
]
}

export default config;
```
Loading