- App.tsx: full navigation (Auth stack + Main tabs with 5 screens) - Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen - HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors - MapScreen: interactive map with layer toggles (6 layers) - MarketplaceScreen: categories (6), products (5), search - ChatScreen: AI chat with quick prompts (4), bot responses - ProfileScreen: user info, stats, menu (9 items), logout - AlertsScreen: alert list with severity, acknowledge - SensorsScreen: sensor list with type filters (6 types), search - ZonesScreen: zone cards with stats - SettingsScreen: language picker (FR/EN/ES/DE), privacy, about - Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n - Hooks: useSensors, useAlerts, useNotifications, useLocation - Components: Card, Button, LoadingSpinner, ErrorBoundary, Header - Services: iotService, notificationService (with axios API client) - Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN) - Theme: colors.ts with full design system (Blue Ocean palette) - Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
82 lines
2.1 KiB
Markdown
82 lines
2.1 KiB
Markdown
# on-headers
|
|
|
|
[![NPM Version][npm-version-image]][npm-url]
|
|
[![NPM Downloads][npm-downloads-image]][npm-url]
|
|
[![Node.js Version][node-image]][node-url]
|
|
[![Build Status][ci-image]][ci-url]
|
|
[![Coverage Status][coveralls-image]][coveralls-url]
|
|
|
|
Execute a listener when a response is about to write headers.
|
|
|
|
## Installation
|
|
|
|
This is a [Node.js](https://nodejs.org/en/) module available through the
|
|
[npm registry](https://www.npmjs.com/). Installation is done using the
|
|
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
|
|
|
```sh
|
|
$ npm install on-headers
|
|
```
|
|
|
|
## API
|
|
|
|
<!-- eslint-disable no-unused-vars -->
|
|
|
|
```js
|
|
var onHeaders = require('on-headers')
|
|
```
|
|
|
|
### onHeaders(res, listener)
|
|
|
|
This will add the listener `listener` to fire when headers are emitted for `res`.
|
|
The listener is passed the `response` object as it's context (`this`). Headers are
|
|
considered to be emitted only once, right before they are sent to the client.
|
|
|
|
When this is called multiple times on the same `res`, the `listener`s are fired
|
|
in the reverse order they were added.
|
|
|
|
## Examples
|
|
|
|
```js
|
|
var http = require('http')
|
|
var onHeaders = require('on-headers')
|
|
|
|
http
|
|
.createServer(onRequest)
|
|
.listen(3000)
|
|
|
|
function addPoweredBy () {
|
|
// set if not set by end of request
|
|
if (!this.getHeader('X-Powered-By')) {
|
|
this.setHeader('X-Powered-By', 'Node.js')
|
|
}
|
|
}
|
|
|
|
function onRequest (req, res) {
|
|
onHeaders(res, addPoweredBy)
|
|
|
|
res.setHeader('Content-Type', 'text/plain')
|
|
res.end('hello!')
|
|
}
|
|
```
|
|
|
|
## Testing
|
|
|
|
```sh
|
|
$ npm test
|
|
```
|
|
|
|
## License
|
|
|
|
[MIT](LICENSE)
|
|
|
|
[ci-image]: https://badgen.net/github/checks/jshttp/on-headers/master?label=ci
|
|
[ci-url]: https://github.com/jshttp/on-headers/actions/workflows/ci.yml
|
|
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-headers/master
|
|
[coveralls-url]: https://coveralls.io/r/jshttp/on-headers?branch=master
|
|
[node-image]: https://badgen.net/npm/node/on-headers
|
|
[node-url]: https://nodejs.org/en/download
|
|
[npm-downloads-image]: https://badgen.net/npm/dm/on-headers
|
|
[npm-url]: https://npmjs.org/package/on-headers
|
|
[npm-version-image]: https://badgen.net/npm/v/on-headers
|