jsgui3-server 0.0.96 → 0.0.97

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 (40) hide show
  1. package/controls/Active_HTML_Document.js +90 -0
  2. package/examples/box/box.css +8 -0
  3. package/examples/box/out_square_box_client.js +28862 -0
  4. package/examples/box/square_box.js +52 -1
  5. package/examples/box/square_box_client.js +41 -4
  6. package/package.json +11 -8
  7. package/publishers/http-js-publisher.js +136 -0
  8. package/{publishing → publishers}/http-webpage-publisher.js +16 -0
  9. package/{publishing → publishers}/http-website-publisher.js +245 -8
  10. package/{publishing → publishers}/notes.md +3 -0
  11. package/resources/_old_website-javascript-resource.js +995 -0
  12. package/resources/process-js.js +5 -0
  13. package/{bundler → resources/processors/bundlers}/bundle.js +11 -0
  14. package/resources/processors/bundlers/bundler.js +24 -0
  15. package/{bundler → resources/processors/bundlers}/css-bundler.js +3 -3
  16. package/{bundler → resources/processors/bundlers}/js-bundler.js +28 -0
  17. package/{bundler → resources/processors/bundlers}/webpage-bundler.js +71 -1
  18. package/resources/website-audio-resource.js +3 -0
  19. package/resources/website-javascript-resource-processor.js +909 -0
  20. package/resources/website-javascript-resource.js +138 -162
  21. package/resources/website-resource-processor.js +11 -0
  22. package/resources/website-resource.js +5 -3
  23. package/roadmap.md +6 -0
  24. package/server.js +119 -14
  25. package/website/webpage.js +36 -1
  26. package/website/website.js +9 -1
  27. package/bundler/bundler.js +0 -9
  28. package/publishing/http-js-publisher.js +0 -25
  29. /package/{publishing → publishers}/http-css-publisher.js +0 -0
  30. /package/{publishing → publishers}/http-function-publisher.js +0 -0
  31. /package/{publishing → publishers}/http-html-page-publisher.js +0 -0
  32. /package/{publishing → publishers}/http-html-publisher.js +0 -0
  33. /package/{publishing → publishers}/http-jpeg-publisher.js +0 -0
  34. /package/{publishing → publishers}/http-observable-publisher.js +0 -0
  35. /package/{publishing → publishers}/http-png-publisher.js +0 -0
  36. /package/{publishing → publishers}/http-publisher.js +0 -0
  37. /package/{publishing → publishers}/http-resource-publisher.js +0 -0
  38. /package/{publishing → publishers}/http-svg-publisher.js +0 -0
  39. /package/{bundler → resources/processors/bundlers}/test_ast.js +0 -0
  40. /package/{bundler → resources/processors/bundlers}/website-bundler.js +0 -0
@@ -17,7 +17,58 @@ const Server = require('../../server');
17
17
 
18
18
  if (require.main === module) {
19
19
 
20
+ // By default should include the JS and the CSS.
21
+ // By reference, serving them from their respective paths.
22
+
23
+
20
24
  // This API is not working right now.
25
+
26
+ // A very simple syntax for running a single control would be great.
27
+
28
+ // Need to in the default (server) configuration build and serve the client-side app.
29
+ // Want to be able to make interactive apps quickly with minimal server side code that needs to be written as boilerplate to
30
+ // get the app running.
31
+
32
+ // Though maybe defining a webpage, that serves the client js, and renders the control on the server, and activates it on the client,
33
+ // would be the right approach.
34
+
35
+ // Want to make the code really explicit, in a simple way.
36
+
37
+
38
+ // eg { '/': Demo_UI }
39
+ // eg { '*': Demo_UI }
40
+ // as at least it explicitly assigns it to the '/' route
41
+
42
+
43
+ // But worth keeping the '/' Ctrl property?
44
+ // Could change it to explicitly setting the route(s).
45
+
46
+ // Do want it to build the client js on start.
47
+
48
+ // Could extract the CSS from the file itself, or maybe better reading it from the classes and objects that are loaded / referenced.
49
+ // All kinds of complex server program structures exist already, so could use Publishers if needed for some things.
50
+ // But need to keep the surface-level API really simple.
51
+
52
+ // Maybe define a Webpage and maybe use / define an HTML_Webpage_Publisher for example too.
53
+ // The clearest code would be really explicit about what it does, but in terms of almost English idioms
54
+ // and on the surface-level not spelling out in great detail what it's doing, but referencing objects and
55
+ // instructions with clear purposes, though details could be obscure at the top level. Eg it's the publisher's responsibility
56
+ // to include the CSS and JS that's needed to get it to run. A publisher is referenced and used, and it does its thing.
57
+
58
+ // The Server could automatically involk the use of a Publisher.
59
+ // May be better to either require or recommend more explicit code, have them in the examples,
60
+ // but also to document some shortcuts, defaults, and abbreviations (though they may omit some essential info, so not recommended for beginners)
61
+
62
+ // Could have a tabbed view for examples for 'explicit' and 'short' notations when there are multiple.
63
+
64
+ // jsgui3-html-suite may be of use, for some more extended controls that are built on top of jsgui3-html, but not specifically
65
+ // client or server.
66
+
67
+
68
+
69
+
70
+
71
+
21
72
  const server = new Server({
22
73
  Ctrl: Demo_UI,
23
74
  // Giving it the Ctrl and disk path client js should enable to server to get the JS-bundled CSS from the file(s).
@@ -25,7 +76,7 @@ if (require.main === module) {
25
76
 
26
77
 
27
78
  //'js_mode': 'debug',
28
- 'disk_path_client_js': require.resolve('./square_box_client.js')
79
+ 'src_path_client_js': require.resolve('./square_box_client.js')
29
80
  //js_client: require.resolve('./square_box.js')
30
81
  });
31
82
  // A callback or event for when the bundling has been completed
@@ -2,20 +2,33 @@ const jsgui = require('jsgui3-client');
2
2
  const {controls, Control, mixins} = jsgui;
3
3
  const {dragable} = mixins;
4
4
 
5
+ const Active_HTML_Document = require('../../controls/Active_HTML_Document');
6
+
7
+ // Maybe better to include it within an Active_HTML_Document.
8
+
9
+
10
+
11
+
5
12
  // Relies on extracting CSS from JS files.
6
13
 
7
- class Demo_UI extends Control {
14
+ class Demo_UI extends Active_HTML_Document {
8
15
  constructor(spec = {}) {
9
16
  spec.__type_name = spec.__type_name || 'demo_ui';
10
17
  super(spec);
11
18
  const {context} = this;
12
- this.add_class('demo-ui');
19
+
20
+ // Make sure it requires the correct CSS.
21
+ // Though making that 'effortless' on the server may help more.
22
+
23
+
24
+
25
+ this.body.add_class('demo-ui');
13
26
 
14
27
  const compose = () => {
15
28
  const box = new Square_Box({
16
29
  context: context
17
30
  })
18
- this.add(box);
31
+ this.body.add(box);
19
32
  }
20
33
  if (!spec.el) {
21
34
  compose();
@@ -41,6 +54,30 @@ class Demo_UI extends Control {
41
54
  // Want CSS bundling so that styles are read out from the JS document and compiled to a stylesheet.
42
55
 
43
56
  //controls.Demo_UI = Demo_UI;
57
+
58
+ // A css file may be an easier way to get started...?
59
+ // Want to support but not require css in js.
60
+
61
+ // But need to set up the serving of the CSS both on the server, and on the client.
62
+ // Ofc setting it up on the server first is important - then can that stage set it up in the doc sent to the client?
63
+
64
+ // Including the CSS from the JS like before.
65
+ // Needs to extract the CSS and serve it as a separate CSS file.
66
+ // Should also have end-to-end regression tests so this does not break again in the future.
67
+ // The code was kind of clunky and got refactored away.
68
+ //
69
+
70
+ // Would need to parse the JS files to extract the CSS.
71
+ // Maybe could do it an easier way???
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
44
81
  Demo_UI.css = `
45
82
  .demo-ui {
46
83
  display: flex;
@@ -69,7 +106,7 @@ class Square_Box extends Control {
69
106
 
70
107
  console.log('dragable mixin applied to square');
71
108
  this.dragable = true;
72
- console.log('this.dragable = true;');
109
+ //console.log('this.dragable = true;');
73
110
 
74
111
  this.on('dragend', e => {
75
112
  console.log('square box dragend e', e);
package/package.json CHANGED
@@ -3,21 +3,24 @@
3
3
  "main": "module.js",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
- "@babel/core": "^7.22.9",
7
- "@babel/generator": "^7.22.9",
8
- "@babel/parser": "7.22.7",
6
+ "@babel/core": "^7.22.20",
7
+ "@babel/generator": "^7.22.15",
8
+ "@babel/parser": "7.22.16",
9
9
  "babel-plugin-transform-runtime": "^6.23.0",
10
10
  "babel-preset-minify": "^0.5.2",
11
11
  "browserify": "17.0.0",
12
12
  "child-process": "^1.0.2",
13
13
  "cookies": "^0.8.0",
14
- "fnl": "^0.0.25",
15
- "fnlfs": "^0.0.27",
16
- "jsgui3-client": "^0.0.75",
14
+ "esbuild": "^0.19.3",
15
+ "fnl": "^0.0.27",
16
+ "fnlfs": "^0.0.28",
17
+ "jsgui3-client": "^0.0.79",
18
+ "jsgui3-webpage": "^0.0.3",
19
+ "jsgui3-website": "^0.0.3",
17
20
 
18
21
  "multiparty": "^4.2.3",
19
22
  "ncp": "^2.0.0",
20
- "obext": "^0.0.24",
23
+ "obext": "^0.0.25",
21
24
  "rimraf": "^3.0.2",
22
25
  "stream-to-array": "^2.3.0",
23
26
  "url-parse": "^1.5.10"
@@ -41,5 +44,5 @@
41
44
  "type": "git",
42
45
  "url": "https://github.com/metabench/jsgui3-server.git"
43
46
  },
44
- "version": "0.0.96"
47
+ "version": "0.0.97"
45
48
  }
@@ -0,0 +1,136 @@
1
+
2
+
3
+ // Publishes the HTML format.
4
+
5
+
6
+ const HTTP_Publisher = require('./http-publisher');
7
+
8
+ // This part will process the requests and responses, not the JS resource itself.
9
+
10
+
11
+
12
+ class HTTP_JS_Publisher extends HTTP_Publisher {
13
+ constructor(spec) {
14
+
15
+ // Should probably take one or more JS Resources.
16
+
17
+
18
+
19
+ super(spec);
20
+ }
21
+
22
+ // Will publish HTML documents over HTTP, but seems as though it would need to be configured / called with
23
+ // something to render as well as a rendering engine and parameters.
24
+
25
+ // compilation = rendering? not exactly.
26
+
27
+ // handle_http()
28
+
29
+ 'handle_http'(req, res) {
30
+
31
+ // Will the resource itself process the requests? Maybe only the Resource Publisher should do that.
32
+ // A greater level of abstraction there, more splitting of responsibilities.
33
+
34
+
35
+
36
+
37
+
38
+ console.log('HTTP_JS_Publisher processing req.url', req.url);
39
+ var remoteAddress = req.connection.remoteAddress;
40
+ var custom_paths = this.custom_paths;
41
+ var rurl = req.url.replace(/\./g, '☺');
42
+ var custom_response_entry = custom_paths[rurl];
43
+ var pool = this.pool;
44
+ if (custom_response_entry) {
45
+ const ae = req.headers['accept-encoding'];
46
+ let data_to_serve;
47
+ let o_head = {
48
+ 'Content-Type': 'text/javascript'
49
+ }
50
+ if (ae.includes('gzip')) {
51
+ o_head['Content-Encoding'] = 'gzip';
52
+ data_to_serve = custom_response_entry._.gzip;
53
+ } else {
54
+ data_to_serve = custom_response_entry._.raw;
55
+ }
56
+ res.writeHead(200, o_head);
57
+ res.end(data_to_serve);
58
+ } else {
59
+ //var served_directories = this.served_directories;
60
+ //console.log('served_directories', served_directories);
61
+ var url_parts = url.parse(req.url, true);
62
+ //console.log('url_parts ' + stringify(url_parts));
63
+ var splitPath = url_parts.path.substr(1).split('/');
64
+
65
+ var wildcard_value = req.params.wildcard_value;
66
+ //console.log('*** wildcard_value', wildcard_value);
67
+
68
+ if (wildcard_value == 'web/require.js') {
69
+
70
+ } else {
71
+ var disk_path = path.dirname(require.main.filename) + '/' + 'js/' + wildcard_value;
72
+ var compress = false;
73
+
74
+
75
+ //console.log('disk_path', disk_path);
76
+
77
+ if (compress) {
78
+ throw 'NYI with Babel';
79
+
80
+ } else {
81
+ // try to load it from the project's js path.
82
+ //console.log('disk_path', disk_path);
83
+ var project_js_path = 'js/' + wildcard_value;
84
+ //console.log('project_js_path', project_js_path);
85
+
86
+ fs2.load_file_as_string(disk_path, function (err, str_js) {
87
+ if (err) {
88
+ console.log('error loading from project_js_path: ', project_js_path);
89
+ console.log(err);
90
+ } else {
91
+ // Have loaded the js from the project path, we can serve it.
92
+ console.log('have loaded js');
93
+ // serve the js.
94
+
95
+
96
+ //res.writeHead(200, {'Content-Type': 'text/javascript'});
97
+ // Could possibly stream it from disk instead, that would likely be more efficient.
98
+ console.log('str_js.length', str_js.length);
99
+
100
+
101
+ // use gzip in many cases.
102
+ // want to support that.
103
+
104
+ // a streaming middleware fn could work...?
105
+
106
+ zlib.deflate(str_js, function (err, buffer) {
107
+ console.log('deflated buffer.length', buffer.length);
108
+
109
+
110
+ if (err) throw err;
111
+ res.writeHead(200, {
112
+ 'Content-Encoding': 'deflate',
113
+ 'Content-Type': 'text/javascript'
114
+ });
115
+ res.end(buffer);
116
+ //res.writeHead(200, {'Content-Type': 'text/javascript'});
117
+ //response.end(servableJs);
118
+ //res.end(minified.code);
119
+ });
120
+
121
+
122
+ //response.end(servableJs);
123
+ //res.end(str_js);
124
+ //throw 'stop';
125
+ }
126
+ })
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+
133
+
134
+ }
135
+
136
+ module.exports = HTTP_JS_Publisher;
@@ -1,3 +1,11 @@
1
+ // Want to get it (back) working as a server easily serving simple controls and pages and sites.
2
+ // Need to tame some of the more complex layers inside it to get it to easily serve the app.
3
+ // Then should work on making / improving some of the specific controls.
4
+ // Make the code idiomatic and DRY. The more complex lower and middle level abstractions will help with that.
5
+ // Use polymorphism and run-time checks to allow for some more flexibility.
6
+
7
+
8
+
1
9
 
2
10
 
3
11
  // A publisher handles HTTP requests.
@@ -9,6 +17,14 @@
9
17
  const HTTP_Publisher = require('./http-publisher');
10
18
  const {obs} = require('fnl');
11
19
 
20
+ // May want / need to more carefully and specifically define APIs.
21
+ // It's nice to have classes for specific things like this, but need to make them do what is needed.
22
+ // Maybe get a 'Website' object or control ready to be served.
23
+ //
24
+
25
+
26
+
27
+
12
28
  // Named observables?
13
29
  /*
14
30
 
@@ -7,8 +7,13 @@ const {each, Router, tof} = require('jsgui3-html');
7
7
  const HTTP_Publisher = require('./http-publisher');
8
8
  const {obs} = require('fnl');
9
9
 
10
- const Webpage_Bundler = require('./../bundler/webpage-bundler');
11
- const Bundle = require('./../bundler/bundle');
10
+ // The Webpage bundler should be able to come up with the compiled JS and CSS, maybe even a favicon.
11
+
12
+
13
+ const Website = require('jsgui3-website');
14
+
15
+ const Webpage_Bundler = require('../resources/processors/bundlers/webpage-bundler');
16
+ const Bundle = require('../resources/processors/bundlers/bundle');
12
17
 
13
18
  // Now it's the very basics of a website publisher. Quite flexible but could do with more.
14
19
  // Better integration with bundler
@@ -28,22 +33,93 @@ const Bundle = require('./../bundler/bundle');
28
33
  // This seems more like the server router these days
29
34
  // The main server router seems to pass everything to this - maybe that will change.
30
35
 
36
+ // Maybe give it some kind of Website_Server????
37
+
38
+ // Have the Website_Server use the Website_Publisher????
39
+
40
+ // Need to somewhat separate concerns.
41
+
42
+ // Publisher here could be simple in terms of bundling, and then giving the paths to the router.
43
+ // And could have really simple code implementation of doing just that.
44
+
45
+ // This basically can be simple....
46
+ // But make the classes' structures more complicated where necessary to accommodate.
47
+
48
+
49
+ // Could be just a few lines of logic probably, at least the simplest core implementation.
50
+
51
+ // Think the server or the website already has a router, so have the website resource's router do the routing.
52
+ // Maybe upgrade the routers to handle premade (compressed) responses.
53
+
54
+ // Maybe better to bundle and publish resources.
55
+ // resource-processors in its own dir?
56
+ // as in it's not actually part of resources?
57
+
58
+
59
+
60
+
61
+ // Need to basically make this do very little.
62
+
63
+ // Publish (website, server_router)
64
+
65
+
66
+ // Or publish it only under some URLs / domains....?
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
31
78
  class HTTP_Website_Publisher extends HTTP_Publisher {
32
79
  // Website generally serves JS from a single address.
33
80
  // Webpage could have its specific JS.
34
81
 
82
+
83
+ // Maybe the Publisher should not have its own router?
84
+ // But it provides items with paths from bundles it gets made to the website server's router.
85
+
86
+ // Def looks like its worth rearchitecturing this to provide more consistency on the lower level, and a 'just works' simplicity
87
+ // on the higher level.
88
+
89
+ // Plus some base classes that themselves don't do all that much, and then subclasses of them that do things in specific
90
+ // ways, so that implementations of specific parts are interchangable.
91
+
92
+
93
+
94
+
95
+
35
96
  constructor(spec = {}) {
36
97
  super(spec)
37
98
  // A website property.
38
99
 
39
100
  let website;
40
- if (spec.website) website = spec.website;
101
+ if (spec.website) {
102
+ if (spec.website instanceof Website) {
103
+ website = spec.website;
104
+ } else {
105
+ console.trace();
106
+ throw 'Expected spec.website to be of type "jsgui3-website" class instance';
107
+ }
108
+ }
41
109
  Object.defineProperty(this, 'website', {
42
110
  get() {
43
111
  return website;
44
112
  }
45
113
  });
46
114
 
115
+ // The publisher should not have a router (for the moment???)
116
+ // It should however determine routes, and provide them to the router.
117
+
118
+ // Creating a Published_Website object perhaps.
119
+
120
+
121
+ /*
122
+
47
123
  let router = new Router();
48
124
  Object.defineProperty(this, 'router', {
49
125
  get() {
@@ -51,6 +127,14 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
51
127
  }
52
128
  });
53
129
 
130
+ */
131
+
132
+
133
+
134
+ // Disk path client js being a property of the website itself?
135
+ // Critical overall functionality, dont want to remove it from here for the moment. See if not critical here.
136
+
137
+
54
138
  let disk_path_client_js;
55
139
  if (spec.disk_path_client_js) disk_path_client_js = spec.disk_path_client_js;
56
140
  Object.defineProperty(this, 'disk_path_client_js', {
@@ -58,19 +142,108 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
58
142
  return disk_path_client_js;
59
143
  }
60
144
  });
145
+
146
+
147
+
61
148
  // And this could be an observable too.
62
149
  // May get admin pages working on a slightly lower level.
63
150
  // Makes sense as they are for administering other pages (mostly).
64
- console.log('http-website-publisher disk_path_client_js', disk_path_client_js);
151
+
152
+
153
+ //console.log('http-website-publisher disk_path_client_js', disk_path_client_js);
154
+
155
+
156
+
65
157
  //throw 'stop';
66
158
  // This could be an observable that acts sequentially and async.
67
159
 
68
- const setup_website_publishing = (website) => {
160
+ // See about moving specific complexity elsewhere....
161
+ // See if what the website publisher does can be summed up expressively in JS.
162
+
163
+ // Uses a builder / packager on the website.
164
+ // Keeps track of a little bit of data on what's been published (could have an observable status event)
165
+ // Tells the server to publish it (on specified URL / Route - specified where? Defaults? Interchangable systems of default URLS paths?)
166
+
167
+
168
+ // But make this async (obs as well?)
169
+ // Have a sequence of events that takes place.
170
+ // Use the correct specific classes to do the correct specific things.
171
+ // Then make sure the implementations are correct.
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ const __old__setup_website_publishing = (website) => {
183
+
184
+
185
+ // Split up the bundling and response serving responsibilities.
186
+ // Should put it through the router (more as normal) when published.
187
+ // Maybe I'll need another 100 classes for this to work, maybe not, but should make everything explicit, but also concise,
188
+ // and then work on abbreviations and (unambiguous) shorthands.
189
+ // Or even settings for what the (default) shorthands do.
190
+
191
+
192
+ // Bundle it - Get some package(bundle) of pages.
193
+
194
+ // Website_Bundle perhaps...?
195
+ // All the static assets put together.
196
+ // Pages that don't have dynamic content are pre-rendered and compressed.
197
+
198
+
199
+
200
+
201
+
202
+ // 1) Bundle
203
+ // 2) Publish that bundle
204
+ // 2a) Provide the router with all the necessary URLs and (compressed) pregenerated responses from that bundle.
205
+
206
+
207
+ // Website_Bundle_Publisher perhaps....?
208
+
209
+ // Def seems worth it to refactor it into still more complicated classes, but to aim for really simple and concise code within
210
+ // those classes, at least when it comes to a simple and intuitive API that represents what is going on.
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
69
228
  //console.log('website', website);
70
229
  //console.log('website.pages', website.pages);
71
230
  //console.log('website.pages.length()', website.pages.length());
72
231
  //throw 'stop';
73
232
 
233
+ // This is currently really inflexible for a website with multiple pages.
234
+ // Pages could be given names.
235
+ // Don't want to be too prescriptive here, but do want to get this bundling and working.
236
+
237
+ // Do want to get it right in theory and in structure for a variety of possibilities.
238
+
239
+ // Should pay more attention to setting up the headers on the responses.
240
+
241
+
242
+
243
+
244
+
245
+
246
+
74
247
  // should the website have a 'main' or 'front' or 'first' page, with it having its HTML rendered?
75
248
  return obs((next, complete, error) => {
76
249
  (async () => {
@@ -133,9 +306,6 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
133
306
 
134
307
  //console.trace();
135
308
  //throw 'stop';
136
-
137
-
138
-
139
309
  complete(obs_bundling_res);
140
310
  } else {
141
311
 
@@ -283,12 +453,63 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
283
453
 
284
454
  //throw 'NYI';
285
455
  }
456
+
457
+
286
458
  if (website) {
459
+
460
+
461
+ console.trace();
462
+
463
+ throw 'NYI - HTTP_Website_Publisher needs to publish specified website';
464
+
465
+
466
+ // Website_Bundle class would help.
467
+
468
+ // jsgui3-website-bundle.
469
+ // Could make a separate module for it, give it a very simple API.
470
+ // Probably would only want to bundle websites on the server though.
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+
480
+ // Prepare website for publishing
481
+ // Prepare being building static resources, making a list of the static routes / page content to serve.
482
+ // Static_Route_Content clases somewhere too.
483
+
484
+
485
+ // Use many different class names to help keep track of what the objects do, and allow for flexibility.
486
+
487
+
488
+
489
+ // Then the type of the website....
490
+ // Do make use of runtime polymorphism and type checking.
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+ /*
501
+
287
502
  const obs_setup = setup_website_publishing(website);
503
+
504
+
288
505
  obs_setup.on('complete', res_complete => {
289
506
  console.log('setup complete');
290
507
  this.raise('ready');
508
+
509
+
291
510
  })
511
+
512
+ */
292
513
  } else {
293
514
  this.raise('ready');
294
515
  }
@@ -310,10 +531,21 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
310
531
  // .build?
311
532
 
312
533
  }
534
+
535
+
313
536
  handle_http(req, res) {
537
+ // Because it's already been set up in the router! It should have been.
538
+ return this.router.process(req, res);
539
+
314
540
  // Called from a different context? Doubt we want that.
315
541
  // Now called strangely, without context.
316
542
 
543
+
544
+ // The router does it all...???
545
+
546
+
547
+ /*
548
+
317
549
  const {website, router} = this;
318
550
 
319
551
  //console.log('HTTP_Website_Publisher handle_http');
@@ -336,6 +568,11 @@ class HTTP_Website_Publisher extends HTTP_Publisher {
336
568
  //console.log('this', this);
337
569
  //console.trace();
338
570
  router.process(req, res);
571
+
572
+ */
573
+
574
+
575
+
339
576
  // can then get the port from after the : in the host.
340
577
  //router.set_route(url,)
341
578
 
@@ -3,4 +3,7 @@ May need to work without all the HTML and Control things for some applications.
3
3
 
4
4
  Will have more of an abundance of mid-level HTTP publishing code.
5
5
 
6
+ Want to avoid getting bogged down in this when publishing / serving a simple site or page.
7
+ Though this can be used, it could operate with default configurations, and provide functionality that gets used as needed during the process.
8
+
6
9