binhend 1.0.1 → 1.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "binhend",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Nguyen Duc Binh",
package/src/api.js CHANGED
@@ -44,12 +44,12 @@ function mapAPIs(dirpath, router) {
44
44
  }
45
45
 
46
46
  function APIs(rootpath) {
47
+ if (rootpath == undefined) return;
48
+
47
49
  const router = express.Router();
48
50
  router.use(express.urlencoded({ extended: false }));
49
51
  router.use(express.json());
50
52
 
51
- rootpath = rootpath || join(__dirname, 'routes');
52
-
53
53
  setTimeout(function() {
54
54
  mapAPIs(rootpath, router);
55
55
  });
package/src/binh.js CHANGED
@@ -116,7 +116,7 @@ function Binh() {
116
116
  configloader.done(function(configs) {
117
117
  new Server({
118
118
  port: _this.port.value,
119
- api: new APIs(_this.api.value),
119
+ api: APIs(_this.api.value),
120
120
  callback: callback,
121
121
  configs: configs
122
122
  });
package/src/server.js CHANGED
@@ -4,7 +4,7 @@ function Server(options) {
4
4
  const server = express();
5
5
  const PORT = options.port || 1300;
6
6
 
7
- if (options.api) {
7
+ if (options.api instanceof Function) {
8
8
  server.use(options.api);
9
9
  }
10
10