1717 < link rel =icon type ='image/png ' href ='/blog/image/blog-30.png '>
1818 < meta name =viewport content ='width=device-width, initial-scale=1 '>
1919
20-
2120 < base href ='https://ext-code.com/blog/25-07-24/http-server/ '>
2221 < link rel =canonical href ='https://ext-code.com/blog/25-07-24/http-server/http-server.html '>
2322
24-
25-
2623 < script type ='application/ld+json '>
2724
2825 {
4340 < script src ='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js '> </ script >
4441
4542
46- < script src ='https://libs.ext-code.com/js/dom/component/component.js '> </ script >
43+ < script src ='https://libs.ext-code.com/js/dom/component/v2.0/component.js?hdr '> </ script >
44+
45+ < script >
46+
4747
48- < script init >
49- console . clear ( ) ;
50- console . log ( 'http-server.html' ) ;
51- console . log ( ) ;
52- console . json = v => console . log ( JSON . stringify ( v , null , 4 ) ) ;
53- var df = true , version = 'v2.0'
54- ;
55-
56-
57- var ext ;
58- var $ ;
59- var datatype ;
60- var menumod ;
61- var keydown ;
62- var code ;
63- var debug ;
64-
65- var menu ;
66-
67- var hdr ;
6848 var snippet ;
6949
7050
71- //:
72-
73-
74- async function init ( ) {
75- //debug('init',version);
76-
77- menu = menumod ( ) ;
78-
79- mod . base . add ( { ext, $, datatype, keydown, menu, menumod, ace} ) ;
80-
81-
82- hdr = mod [ 'blog-hdr' ] ;
83- snippet = mod . snippet ;
84-
85- hdr . initmod ( { ext, $} ) ;
86- snippet . initmod ( { ext, $, menu, ace, on} ) ;
87-
51+ async function start ( ) {
52+
53+ snippet = mod . snippet ;
8854
89- await Promise . all ( [
90- hdr . init ( ) ,
91- snippet . init ( ) ,
92- ] ) ;
55+ snippet . initmod ( { on} ) ;
9356
9457
9558 initdom ( document . body ) ;
9659
9760
98- } //init
61+ } //start
9962
10063
101- //:
102-
103-
104- ( async ( ) => {
105-
106- mod . stack . add ;
107-
108- ( { ext} = await import ( 'https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js' ) ) ;
109-
110- var promise = ext . load . libs (
111- 'js/dom/$.js.api' ,
112- 'js/core/datatype.js' ,
113- 'js/dom/menumod/menumod.js' ,
114- 'js/dom/keydown/keydown.js' ,
115- 'js/dom/code/v2.0/code-v2.0.js.api' ,
116- 'js/debug/debug.js' ,
117- ) ;
118- [ $ , datatype , menumod , keydown , code ] = await promise ;
119-
120- code . initmod ( { ext, $, datatype, menumod} ) ;
121-
122- mod . stack . complete ;
123-
124- } ) ( ) ;
125-
126-
127- </ script init>
128-
129-
130-
64+ </ script >
13165
13266
133- < link rel =icon type ='image/png ' href ='/blog/image/blog-30.png '>
134-
135- < link rel =stylesheet href ='/blog/css/blog.css '>
67+ < link rel =stylesheet href ='/blog/css/blog-2.css '>
13668
13769 < style >
13870
139- html
140- {height : 100% ;font-family : arial}
141- body
142- {min-height : calc (100% - 40px );display : flex;flex-direction : column;gap : 10px ;margin : 20px ;align-items : center;
143- padding-bottom : 200px ;box-sizing : border-box;
144- }
145- body > *
146- {max-width : 1400px ;width : 100% ;padding : 0 20px ;}
147-
148-
14971 # snippet-root
15072 {border : 1px solid lightblue;padding : 10px }
15173 # snippet-root > div
16284 # web-page-go
16385 {border : 1px solid lightgray;cursor : pointer;padding : 4px ;box-sizing : border-box;width : 32px ;height : 32px }
16486
165- iframe
87+ # web-page iframe
16688 {height : 500px ;border : 1px solid lightgray;box-sizing : border-box}
16789
16890
169- input
170- {font-size : 16px ;padding : 5px 10px ;box-sizing : border-box}
171- input [type = button ]
172- {cursor : pointer}
17391
17492 </ style >
17593
183101 < h1 class =title >
184102 How To Set Up A Basic HTTP Server In Node.js
185103 </ h1 >
186- < time slot =date datetime =" 2025-10-15 " >
104+ < time slot =date datetime =2025-10-15 >
187105 18 Oct 2025
188106 </ time >
189107 </ blog-hdr >
190108
191109
192- < p id =desc >
193- Learn how to set up a basic HTTP server in Node.js with this hands-on tutorial featuring an interactive, editable code demo you can run in your browser.
110+ < p class =description >
111+ Learn how to set up a basic HTTP server in Node.js with this hands-on tutorial featuring an interactive,
112+ editable code demo you can run in your browser.
194113 </ p >
195114
196115
@@ -200,7 +119,7 @@ <h1 class=title>
200119 < input value =download type =button >
201120 </ div >
202121
203- < snippet-terminal-console id =snippet type =nodejs src ='ex/ex1 .js ' component > </ snippet-terminal-console >
122+ < snippet-terminal-console component id =snippet type =nodejs src ='ex/http-server-simple-example .js ' web-console =' h=100 ' > </ snippet-terminal-console >
204123
205124 </ div >
206125
@@ -242,9 +161,6 @@ <h1 class=title>
242161 iframe = $ ( 'iframe' ) ;
243162
244163
245- snippet . initdom ( ) ;
246-
247-
248164 } //initdom
249165
250166
@@ -258,7 +174,7 @@ <h1 class=title>
258174 var url = window . URL . createObjectURL ( blob ) ;
259175
260176 var a = document . createElement ( 'a' ) ;
261- a . download = 'http-example- server.js' ;
177+ a . download = 'http-server-simple-example .js' ;
262178 a . href = url ;
263179 a . click ( ) ;
264180
@@ -292,6 +208,7 @@ <h1 class=title>
292208
293209
294210 </ script >
211+
295212</ html >
296213
297214
0 commit comments