77
88 < head >
99 < meta charset =utf-8 >
10-
10+
1111 < title >
1212 how to set up HTTP/2 server in Node.js
1313 </ title >
14-
14+
1515 < meta name =description content ='Learn how to set up an HTTP/2 server in Node.js with step-by-step code examples, TLS setup, and performance tips. '>
1616 < link rel =icon type ='image/png ' href ='/blog/image/blog-30.png '>
1717 < meta name =viewport content ='width=device-width, initial-scale=1 '>
1818
1919 < base href ='https://ext-code.com/blog/25-07-23/http2-server/ '>
2020 < link rel =canonical href ='https://ext-code.com/blog/25-07-23/http2-server/http2-server.html '>
2121
22-
22+
2323 < script type ='application/ld+json '>
2424
2525 {
3333 "mainEntityOfPage" : { "@type" :"WebPage" , "@id" :"https://ext-code.com/blog/25-07-23/http2-server/http2-server.html" } ,
3434 "publisher" : { "@type" :"Organization" , "name" :"Your Blog or Company Name" , "logo" :{ "@type" :"ImageObject" , "url" :"https://ext-code.com/favicon.ico" } } ,
3535 }
36-
36+
3737 </ script >
3838<!--
3939 "image" : "https://yourdomain.com/images/http2-nodejs-demo.png"
4040-->
4141
4242
43- <!--
44- //:
45- -->
46-
4743
4844 < script src ='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js '> </ script >
49-
50-
51- < script src ='https://libs.ext-code.com/js/dom/component/component.js '> </ script >
52-
53- < script init >
54- console . clear ( ) ;
45+
46+
47+ < script src ='https://libs.ext-code.com/js/dom/component/v2.0/component.js?hdr '> </ script >
48+
49+ < script >
5550 console . log ( 'http2-server.html' ) ;
56- console . log ( ) ;
57- console . json = v => console . log ( JSON . stringify ( v , null , 4 ) ) ;
58- var version = 'v2.0' , df = true
59- ;
60-
61-
62- var ace ;
51+ var version = 'v2.0' ;
6352
64- var ext ;
65- var $ ;
66- var datatype ;
67- var menumod ;
68- var keydown ;
69- var code ;
70- var debug ;
71-
72- var menu ;
73-
74- var hdr ;
75- var editor ;
76-
7753
78- //:
79-
80-
81- async function init ( ) {
82- //debug('init',version);
83-
84- menu = menumod ( ) ;
85-
86- mod . base . add ( { ext, $, datatype, keydown, menu, menumod, ace} ) ;
87-
88-
89- hdr = mod [ 'blog-hdr' ] ;
90- editor = mod [ 'web-editor' ] ;
91-
92- hdr . initmod ( { ext, $} ) ;
93- editor . initmod ( { ext, $, menu, ace} ) ;
94-
95- await Promise . all ( [
96- hdr . init ( ) ,
97- editor . init ( ) ,
98- ] ) ;
99-
100-
54+ async function ready ( ) {
55+ debug ( 'ready' , version ) ;
10156 initdom ( document . body ) ;
102-
10357
104- } //init
105-
106-
107- //:
108-
109-
110- ( async ( ) => {
111-
112- mod . stack . add ;
58+ } //ready
11359
114- ( { ext} = await import ( 'https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js' ) ) ;
115-
116- var promise = ext . load . libs (
117- 'js/dom/$.js.api' ,
118- 'js/core/datatype.js' ,
119- 'js/dom/menumod/menumod.js' ,
120- 'js/dom/keydown/keydown.js' ,
121- 'js/dom/code/v2.0/code-v2.0.js.api' ,
122- 'js/debug/debug.js' ,
123- ) ;
124- [ $ , datatype , menumod , keydown , code , debug ] = await promise ;
125-
126- code . initmod ( { ext, $, datatype, menumod} ) ;
12760
128- mod . stack . complete ;
129-
130- } ) ( ) ;
131-
132-
133- </ script init>
134-
135-
61+ </ script >
62+
63+
64+ < link rel =stylesheet href ='../../css/blog.css ' crossorigin =anonymous >
65+
13666 < style >
13767
138- html
139- {height : 100% ;font-family : arial}
140- body
141- {min-height : calc (100% - 40px );display : flex;flex-direction : column;gap : 20px ;margin : 20px ;align-items : center;
142- padding-bottom : 200px ;
143- }
144- body > *
145- {max-width : 1400px ;width : 100% ;padding : 0 20px ;}
146-
147- [component ]
148- {display : none}
149-
150- .description
151- {max-width : 1000px ;text-align : justify;border-left : 4px solid # 4a90e2 ;padding : 1rem ;
152- background-color : # f9f9f9 ;font-family : system-ui, sans-serif;font-size : 1rem ;line-height : 1.6 ;color : # 333 }
153- .description > p
154- {margin : 0 }
155- .description > p + p
156- {margin : 10px 0 }
157-
158- code
159- {font-family : monospace;background : whitesmoke}
160- code .inline
161- {display : inline;padding : 5px 10px }
162-
163- a
164- {color : # 4a90e2 ;text-decoration : none;font-weight : 500 }
165- a : hover
166- {text-decoration : underline}
167- .link-domain
168- {font-size : 0.85rem ;color : # 777 ;margin-left : 0.25rem }
169- .link-domain ::before
170- {content : '[' }
171- .link-domain ::after
172- {content : ']' }
173- .link-txt
174- {}
175-
176- input
177- {font-size : 16px ;padding : 5px 7px ;box-sizing : border-box;}
178- input [type = button ]
179- {cursor : pointer}
180-
181-
182-
183-
184-
185-
186-
18768 # editor-root
18869 {border : 2px solid # 4a90e2 ;border-radius : 5px ;padding : 10px ;overflow : hidden;}
18970 # editor-root > div
19071 {margin : 10px }
191-
192-
193-
194-
195-
196-
19772
198-
199-
20073 </ style >
201-
202-
74+
75+
20376 </ head >
20477
20578
20679 < body >
207-
208-
209- < blog-hdr component =grp1 >
210- < h1 class =title >
211- how to set up HTTP/2 server in Node.js
80+
81+
82+ < blog-hdr v2.0 component =grp1 >
83+ < h1 slot =title >
84+ How to Set Up an HTTP/2 Server in Node.js
21285 </ h1 >
213- < time slot =date datetime =2025-10-18 >
214- 22 Oct 2025
86+ < time slot =date datetime =2026-02-04 >
87+ 04 Feb 2026
21588 </ time >
21689 </ blog-hdr >
217-
218-
90+
91+
21992
22093 < div class =description >
221-
22294 < p >
223- how to set up HTTP/2 server in Node.js,
95+ how to set up HTTP/2 server in Node.js
96+ < br >
22497 < a href ='https://nodejs.org/api/http2.html '>
22598 < span >
22699 HTTP/2
@@ -230,8 +103,11 @@ <h1 class=title>
230103 </ span >
231104 </ a >
232105 </ p >
106+ </ div >
107+
108+ < div class =blog-text >
233109 < p >
234- you can
110+ you can
235111 < a href ='/utils/x509/generate-https-certificate/generate-https-certificate.html '>
236112 < span >
237113 create https key / cert
@@ -256,52 +132,45 @@ <h1 class=title>
256132 </ a >
257133 </ li >
258134 </ ul >
135+
136+ </ div >
259137
260- </ div description>
261-
262138
263139 < div id =editor-root >
264140
265141 < div >
266142 < input value =download type =button >
267143 </ div >
268-
269- < web-editor component v2.0 src ='ex/ex1.js '> </ web-editor >
144+
145+ < web-editor component src ='ex/ex1.js ' fullsize > </ web-editor >
270146
271147
272148 </ div >
273-
149+
274150 </ body >
275151
276152
277153 < script >
278154
279-
155+
280156 var btn = { } ;
281157
282158
283159 //:
284160
285161
286162 function initdom ( rootnode ) {
287-
163+
288164 $ ( '[value=download]' ) . onclick = btn . download ;
289-
290-
291- hdr . initdom ( ) ;
292-
293-
294- editor . initdom ( rootnode , { fullsize :true } ) ;
295-
296165
297166 } //initdom
298167
299-
168+
300169 //:
301170
302171
303172 btn . download = function ( ) {
304-
173+
305174 var txt = server . getvalue ( ) ;
306175 var blob = new Blob ( [ txt ] ) ;
307176 var url = window . URL . createObjectURL ( blob ) ;
0 commit comments