-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathwebpage.cpp
251 lines (242 loc) · 6.68 KB
/
webpage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/*
* .============.
* // M A K E / \
* // C++ DEV / \
* // E A S Y / \/ \
* ++ ----------. \/\ .
* \\ \ \ /\ /
* \\ \ \ /
* \\ \ \ /
* -============'
*
* Copyright (c) 2025 Hevake and contributors, all rights reserved.
*
* This file is part of cpp-tbox (https://github.com/cpp-main/cpp-tbox)
* Use of this source code is governed by MIT license that can be found
* in the LICENSE file in the root of the source tree. All contributing
* project authors may be found in the CONTRIBUTORS.md file in the root
* of the source tree.
*/
namespace webpage {
const char* kHtmlHome =
R"(<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TBOX HTTP 示例</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
background-color: #f7f9fc;
}
.header {
text-align: center;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid #eaeaea;
}
h1 {
color: #2c3e50;
}
.card-container {
display: flex;
gap: 1.5rem;
flex-wrap: wrap;
justify-content: center;
}
.card {
background: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
padding: 1.5rem;
width: 200px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.card h2 {
color: #3498db;
margin-top: 0;
}
.card p {
color: #7f8c8d;
}
.btn {
display: inline-block;
background-color: #3498db;
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
font-weight: 500;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #2980b9;
}
.footer {
margin-top: 3rem;
text-align: center;
font-size: 0.9rem;
color: #95a5a6;
}
</style>
</head>
<body>
<div class="header">
<h1>TBOX HTTP 示例服务器</h1>
<p>这是一个简单的C++ HTTP服务器演示</p>
</div>
<div class="card-container">
<div class="card">
<h2>页面一</h2>
<p>演示第一个示例页面</p>
<a href="/1" class="btn">访问</a>
</div>
<div class="card">
<h2>页面二</h2>
<p>演示第二个示例页面</p>
<a href="/2" class="btn">访问</a>
</div>
</div>
<div class="footer">
<p>Powered by TBOX Framework - © 2023</p>
</div>
</body>
</html>
)";
const char* kHtmlPage1 =
R"(<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面一 - TBOX HTTP 示例</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
background-color: #e8f4f8;
}
.container {
background: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
padding: 2rem;
}
h1 {
color: #2980b9;
border-bottom: 2px solid #3498db;
padding-bottom: 0.5rem;
}
.content {
margin-top: 1.5rem;
}
.back {
display: inline-block;
margin-top: 2rem;
background-color: #3498db;
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
}
.back:hover {
background-color: #2980b9;
}
</style>
</head>
<body>
<div class="container">
<h1>页面一</h1>
<div class="content">
<p>这是第一个示例页面,展示了TBOX HTTP服务器的基本路由功能。</p>
<p>您可以根据需要自由扩展这个页面的内容和样式。</p>
</div>
<a href="/" class="back">返回首页</a>
</div>
</body>
</html>)";
const char* kHtmlPage2 =
R"(<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面二 - TBOX HTTP 示例</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
background-color: #f0f4e8;
}
.container {
background: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
padding: 2rem;
}
h1 {
color: #27ae60;
border-bottom: 2px solid #2ecc71;
padding-bottom: 0.5rem;
}
.content {
margin-top: 1.5rem;
}
.feature-list {
margin: 1.5rem 0;
}
.feature-list li {
margin-bottom: 0.5rem;
}
.back {
display: inline-block;
margin-top: 2rem;
background-color: #27ae60;
color: white;
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
}
.back:hover {
background-color: #219653;
}
</style>
</head>
<body>
<div class="container">
<h1>页面二</h1>
<div class="content">
<p>欢迎来到第二个示例页面!这里展示了更多的HTML内容。</p>
<div class="feature-list">
<h3>TBOX框架特点:</h3>
<ul>
<li>高性能的事件循环</li>
<li>简洁的HTTP服务器API</li>
<li>灵活的中间件系统</li>
<li>易于集成的模块化设计</li>
</ul>
</div>
</div>
<a href="/" class="back">返回首页</a>
</div>
</body>
</html>)";
}