binhend 2.1.0 → 2.1.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
package/src/api/loader.js CHANGED
@@ -2,6 +2,7 @@ const { readdirSync, statSync } = require('fs');
2
2
  const { join, parse, resolve } = require('path');
3
3
  const { isUndefined } = require('../utils/typeOf');
4
4
  const { server } = require('../server');
5
+ const { cors } = require('../cors');
5
6
  const express = require('express');
6
7
  const parseBasicAuthToken = require('../middleware/parseBasicAuthToken');
7
8
 
@@ -49,7 +50,8 @@ function loadRouter(dirPath) {
49
50
  return router;
50
51
  }
51
52
 
52
- function loadRoutes(dirPath) {
53
+ function loadRoutes(dirPath, corsOptions) {
54
+ server.use(cors(corsOptions));
53
55
  const router = loadRouter(dirPath);
54
56
  server.use(router);
55
57
  }