@blaasvaer/frmwrk 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/index.js +16 -24
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -10,11 +10,8 @@
10
10
  * Native modules
11
11
  */
12
12
  const http = require('http');
13
- const { Server } = require('socket.io');
14
13
 
15
14
  let port;
16
- let _config;
17
- let _io;
18
15
 
19
16
  /**
20
17
  * Custom modules
@@ -25,7 +22,8 @@ const Utils = require('./utils');
25
22
  /**
26
23
  * Define variables
27
24
  */
28
- let hostname;
25
+ let hostname,
26
+ server;
29
27
 
30
28
  /**
31
29
  * If port number is passed in as first (custom) parameter, set port
@@ -48,9 +46,12 @@ if ( process.env.NODE_ENV !== 'production') {
48
46
  * @return {Node} Node
49
47
  */
50
48
  FW = function ( config ) {
51
- _config = config || {};
49
+ let _this = this;
52
50
 
53
- hostname = _config.hostname ? _config.hostname : '0.0.0.0';
51
+ hostname = config.hostname ? config.hostname : '0.0.0.0';
52
+
53
+ controllers = {};
54
+ models = {};
54
55
 
55
56
  /**
56
57
  * Set the Controller
@@ -113,10 +114,6 @@ console.log("Authorize - check credentials:", credentials);
113
114
  // return true;
114
115
  }
115
116
 
116
- getSocketIO = () => {
117
- return _io;
118
- }
119
-
120
117
  /**
121
118
  * Install framework components and start the server
122
119
  */
@@ -130,19 +127,13 @@ console.log("Authorize - check credentials:", credentials);
130
127
  * Create and start the server
131
128
  * @return {function} Server instance
132
129
  */
133
- const server = http.createServer( handleRequest ).listen(port, hostname, () => {
130
+ http.createServer( handleRequest ).listen(port, hostname, () => {
134
131
  console.log(`Server running at http://${hostname}:${port}`);
135
132
  });
136
-
137
- if ( config.enable_socket_io ) {
138
- _io = new Server( server );
139
- }
140
133
  })
141
134
  .catch(function( err ) {
142
135
  console.log("Install Error:", err);
143
- });
144
-
145
- return this;
136
+ });;
146
137
  };
147
138
 
148
139
  /**
@@ -151,18 +142,19 @@ console.log("Install Error:", err);
151
142
  * Installs the components of the framework like; controllers, models, views, users etc.
152
143
  * @param {Object} config Config object
153
144
  */
154
- global.Install = () => {
155
- global.publicPath = _config.root + '/themes/' + _config.theme;
145
+ global.Install = function Install ( config ) {
146
+ // global.publicPath = config.root + '/themes/' + config.theme + '/' + 'public/';
147
+ global.publicPath = config.root + '/themes/' + config.theme;
156
148
 
157
149
  /**
158
150
  * Installation processes to run
159
151
  * @type {Array}
160
152
  */
161
153
  let install_processes = [
162
- require('./controllers')( _config ),
163
- require('./models')( _config ),
164
- require('./views')( _config ),
165
- require('./connections')( _config ),
154
+ require('./controllers')( config ),
155
+ require('./models')( config ),
156
+ require('./views')( config ),
157
+ require('./connections')( config ),
166
158
  // require('./users')( config )
167
159
  ];
168
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaasvaer/frmwrk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "My personal Node framework",
5
5
  "main": "index.js",
6
6
  "scripts": {