@20syldev/api 3.3.1 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/app.js +3 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <a href="https://api.sylvain.pro"><img src="https://api.sylvain.pro/favicon.ico" alt="Logo" width="25%" height="auto"/></a>
3
3
 
4
4
  # API Personnelle
5
- [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.3.1-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
5
+ [![Version](https://custom-icon-badges.demolab.com/badge/Version%20:-v3.3.2-6479ee?logo=api.sylvain.pro&labelColor=23272A)](https://github.com/20syldev/api/releases/latest)
6
6
  </div>
7
7
 
8
8
  ---
@@ -46,7 +46,7 @@ Enfin, **exécutez** le script de build, qui installera les **dépendances** et
46
46
  $ npm run build
47
47
  ```
48
48
  ```console
49
- > @20syldev/api@3.3.1 build
49
+ > @20syldev/api@3.3.2 build
50
50
  > npm install && node app.js
51
51
 
52
52
  [...]
package/app.js CHANGED
@@ -154,11 +154,12 @@ app.use((req, res, next) => {
154
154
  const timestamp = new Date().toISOString();
155
155
  const method = req.method;
156
156
  const url = req.originalUrl;
157
- const status = res.statusCode === 304 ? 200 : res.statusCode;
158
- const duration = `${Date.now() - startTime}ms`;
159
157
  const platform = req.headers['sec-ch-ua-platform']?.replace(/"/g, '');
160
158
 
161
159
  res.on('finish', () => {
160
+ const status = res.statusCode === 304 ? 200 : res.statusCode;
161
+ const duration = `${Date.now() - startTime}ms`;
162
+
162
163
  logs.push({ timestamp, method, url, status, duration, platform });
163
164
  console.log(`[${new Date().toISOString()}] ${method} ${url} ${res.statusCode} - ${duration} - ${ip}`);
164
165
  if (logs.length > 1000) logs.shift();
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.1",
2
+ "version": "3.3.2",
3
3
  "name": "@20syldev/api",
4
4
  "description": "Node.js API with multiple features. Check the documentation at https://docs.sylvain.pro",
5
5
  "main": "app.js",