You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2152,7 +2152,7 @@ pm2 start app.js
2152
2152
2153
2153
**6. serve-favicon:**
2154
2154
2155
-
Node.js middleware for serving a favicon. The `serve-favicon` module lets us exclude requests for the favicon in our logger middleware. It also caches the icon in memory to improve performance by reducing disk access. In addition, it provides an `ETag` based on the contents of the icon, rather than file system properties.
2155
+
Node.js middleware for serving a favicon. It create new middleware to serve a favicon from the given path to a favicon file. **path** may also be a Buffer of the icon to serve.
2156
2156
2157
2157
**Installation:**
2158
2158
@@ -2180,19 +2180,19 @@ app.listen(3000)
2180
2180
2181
2181
**7. cors:**
2182
2182
2183
-
**C**ross-**O**rigin **R**esource **S**haring (CORS) headers allow apps running in the browser to make requests to servers on different domains (also known as origins). CORS headers are set on the server side - the HTTP server is responsible for indicating that a given HTTP request can be cross-origin. CORS defines a way in which a browser and server can interact and determine whether or not it is safe to allow a cross-origin request.
2183
+
**C**ross-**O**rigin **R**esource **S**haring (CORS) headers allow apps running in the browser to make requests to servers on different domains (also known as origins). CORS headers are set on the server side - the HTTP server is responsible for indicating that a given HTTP request can be cross-origin.
2184
2184
2185
2185
**Installation:**
2186
2186
2187
2187
```js
2188
2188
npm install cors
2189
2189
```
2190
2190
2191
-
**Example:** Enable CORS for a Single Route
2191
+
**Example:**
2192
2192
2193
2193
```js
2194
2194
/**
2195
-
* cors
2195
+
* Enable CORS for a Single Route
2196
2196
*/
2197
2197
constexpress=require('express')
2198
2198
constcors=require('cors')
@@ -2231,7 +2231,6 @@ DB_PASS=root
2231
2231
/**
2232
2232
* config.js
2233
2233
*/
2234
-
2235
2234
constdb=require('db')
2236
2235
2237
2236
db.connect({
@@ -2254,9 +2253,11 @@ npm install fs-extra
2254
2253
**Usage:**
2255
2254
2256
2255
```js
2256
+
/**
2257
+
* fs-extra
2258
+
*/
2257
2259
constfs=require('fs-extra')
2258
2260
2259
-
2260
2261
// Async with callbacks:
2261
2262
fs.copy('/tmp/myfile', '/tmp/mynewfile', err=> {
2262
2263
if (err) returnconsole.error(err)
@@ -2281,9 +2282,9 @@ npm install moment --save
2281
2282
```js
2282
2283
constmoment=require('moment');
2283
2284
2284
-
moment().format('MMMM Do YYYY, h:mm:ss a'); // October 24th 2020, 3:15:22 pm
2285
+
moment().format('MMMM Do YYYY, h:mm:ss a'); // October 24th 2022, 3:15:22 pm
2285
2286
moment().format('dddd'); // Saturday
2286
-
moment().format("MMM Do YY"); // Oct 24th 20
2287
+
moment().format("MMM Do YY"); // Oct 24th 22
2287
2288
```
2288
2289
2289
2290
* Relative Time
@@ -2301,7 +2302,7 @@ moment().startOf('day').fromNow(); // 15 hours ago
0 commit comments