@asapjs/core 0.0.1 → 0.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": "@asapjs/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -2,8 +2,10 @@ import express from 'express';
2
2
  import bodyParser from 'body-parser';
3
3
  import cors from 'cors';
4
4
  import { Sequelize } from 'sequelize-typescript';
5
+
5
6
  import errorHandler from './middleware/errorHandler';
6
7
  import logger from './util/logger';
8
+ import { getConfig, setConfig } from './config';
7
9
 
8
10
  export default class Application {
9
11
  public app: express.Application;
@@ -12,13 +14,16 @@ export default class Application {
12
14
 
13
15
  private config: any;
14
16
 
15
- constructor(dirname: string, config: any) {
16
- this.config = config;
17
+ constructor(dirname: string, projectConfig: any) {
18
+ setConfig(projectConfig);
19
+ this.config = projectConfig;
17
20
  this.app = express();
18
21
  this.initMiddlewares();
19
22
  this.initRouter(dirname);
20
23
  this.app.use(errorHandler);
21
24
  this.sequelize = this.initSequelizeConnection(dirname);
25
+
26
+ console.log(getConfig());
22
27
  }
23
28
 
24
29
  private initRouter(dirname: string) {
@@ -0,0 +1,7 @@
1
+ export let config = null;
2
+
3
+ export const getConfig = () => config;
4
+
5
+ export const setConfig = (v: any) => {
6
+ config = v;
7
+ };
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { default as Application } from './application';
1
+ export { default as Application, getConfig } from './application';
2
2
  export { default as logger } from './util/logger';