Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors. All rights reserved. |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | const fs = require('fs'); |
| 6 | const http = require('http'); |
| 7 | const path = require('path'); |
| 8 | const parseURL = require('url').parse; |
| 9 | const {argv} = require('yargs'); |
| 10 | |
| 11 | const serverPort = parseInt(process.env.PORT, 10) || 8090; |
| 12 | |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 13 | const target = argv.target || process.env.TARGET || 'Default'; |
| 14 | |
| 15 | /** |
| 16 | * This configures the base of the URLs that are injected into each component |
| 17 | * doc example to load. By default it's /, so that we load /front_end/..., but |
| 18 | * this can be configured if you have a different file structure. |
| 19 | */ |
| 20 | const sharedResourcesBase = argv.sharedResourcesBase || '/'; |
Jack Franklin | 086ccd5 | 2020-11-27 11:00:14 +0000 | [diff] [blame] | 21 | |
| 22 | /** |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 23 | * The server assumes that examples live in |
| 24 | * devtoolsRoot/out/Target/front_end/component_docs, but if you need to add a |
| 25 | * prefix you can pass this argument. Passing `foo` will redirect the server to |
| 26 | * look in devtoolsRoot/out/Target/foo/front_end/component_docs. |
| 27 | */ |
| 28 | const componentDocsBaseArg = argv.componentDocsBase || process.env.COMPONENT_DOCS_BASE || ''; |
| 29 | |
| 30 | /** |
Jack Franklin | 086ccd5 | 2020-11-27 11:00:14 +0000 | [diff] [blame] | 31 | * When you run npm run components-server we run the script as is from scripts/, |
| 32 | * but when this server is run as part of a test suite it's run from |
| 33 | * out/Default/gen/scripts, so we have to do a bit of path mangling to figure |
| 34 | * out where we are. |
| 35 | */ |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 36 | const isRunningInGen = __dirname.includes(path.join('out', path.sep, target)); |
Jack Franklin | b36ad7e | 2020-12-07 10:20:52 +0000 | [diff] [blame] | 37 | |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 38 | let pathToOutTargetDir = __dirname; |
| 39 | /** |
| 40 | * If we are in the gen directory, we need to find the out/Default folder to use |
| 41 | * as our base to find files from. We could do this with path.join(x, '..', |
| 42 | * '..') until we get the right folder, but that's brittle. It's better to |
| 43 | * search up for out/Default to be robust to any folder structures. |
| 44 | */ |
| 45 | while (isRunningInGen && !pathToOutTargetDir.endsWith(`out${path.sep}${target}`)) { |
| 46 | pathToOutTargetDir = path.resolve(pathToOutTargetDir, '..'); |
| 47 | } |
Jack Franklin | 0943df4 | 2021-02-26 11:12:13 +0000 | [diff] [blame] | 48 | |
| 49 | /* If we are not running in out/Default, we'll assume the script is running from the repo root, and navigate to {CWD}/out/Target */ |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 50 | const pathToBuiltOutTargetDirectory = |
Jack Franklin | 0943df4 | 2021-02-26 11:12:13 +0000 | [diff] [blame] | 51 | isRunningInGen ? pathToOutTargetDir : path.resolve(path.join(process.cwd(), 'out', target)); |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 52 | |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 53 | const devtoolsRootFolder = path.resolve(path.join(pathToBuiltOutTargetDirectory, 'gen')); |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 54 | const componentDocsBaseFolder = path.join(devtoolsRootFolder, componentDocsBaseArg); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 55 | |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 56 | if (!fs.existsSync(devtoolsRootFolder)) { |
| 57 | console.error(`ERROR: Generated front_end folder (${devtoolsRootFolder}) does not exist.`); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 58 | console.log( |
| 59 | 'The components server works from the built Ninja output; you may need to run Ninja to update your built DevTools.'); |
| 60 | console.log('If you build to a target other than default, you need to pass --target=X as an argument'); |
| 61 | process.exit(1); |
| 62 | } |
| 63 | |
Jack Franklin | 086ccd5 | 2020-11-27 11:00:14 +0000 | [diff] [blame] | 64 | const server = http.createServer(requestHandler); |
| 65 | server.listen(serverPort); |
| 66 | server.once('listening', () => { |
| 67 | if (process.send) { |
| 68 | process.send(serverPort); |
| 69 | } |
| 70 | console.log(`Started components server at http://localhost:${serverPort}\n`); |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 71 | console.log(`component_docs location: ${ |
| 72 | path.relative(process.cwd(), path.join(componentDocsBaseFolder, 'front_end', 'component_docs'))}`); |
Jack Franklin | 086ccd5 | 2020-11-27 11:00:14 +0000 | [diff] [blame] | 73 | }); |
| 74 | |
| 75 | server.once('error', error => { |
| 76 | if (process.send) { |
| 77 | process.send('ERROR'); |
| 78 | } |
| 79 | throw error; |
| 80 | }); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 81 | |
| 82 | function createComponentIndexFile(componentPath, componentExamples) { |
Jack Franklin | 7a75e46 | 2021-01-08 16:17:13 +0000 | [diff] [blame] | 83 | const componentName = componentPath.replace('/front_end/component_docs/', '').replace(/_/g, ' ').replace('/', ''); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 84 | // clang-format off |
| 85 | return `<!DOCTYPE html> |
| 86 | <html> |
| 87 | <head> |
| 88 | <meta charset="UTF-8" /> |
| 89 | <meta name="viewport" content="width=device-width" /> |
| 90 | <title>DevTools component: ${componentName}</title> |
| 91 | <style> |
| 92 | h1 { text-transform: capitalize; } |
| 93 | |
| 94 | .example { |
| 95 | padding: 5px; |
| 96 | margin: 10px; |
| 97 | } |
Jack Franklin | 7a75e46 | 2021-01-08 16:17:13 +0000 | [diff] [blame] | 98 | |
| 99 | a:link, |
| 100 | a:visited { |
| 101 | color: blue; |
| 102 | text-decoration: underline; |
| 103 | } |
| 104 | |
| 105 | a:hover { |
| 106 | text-decoration: none; |
| 107 | } |
| 108 | .example summary { |
| 109 | font-size: 20px; |
| 110 | } |
| 111 | |
| 112 | .back-link { |
| 113 | padding-left: 5px; |
| 114 | font-size: 16px; |
| 115 | font-style: italic; |
| 116 | } |
| 117 | |
| 118 | iframe { display: block; width: 100%; height: 400px; } |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 119 | </style> |
| 120 | </head> |
| 121 | <body> |
Jack Franklin | 7a75e46 | 2021-01-08 16:17:13 +0000 | [diff] [blame] | 122 | <h1> |
| 123 | ${componentName} |
| 124 | <a class="back-link" href="/">Back to index</a> |
| 125 | </h1> |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 126 | ${componentExamples.map(example => { |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 127 | const fullPath = path.join(componentPath, example); |
Jack Franklin | 7a75e46 | 2021-01-08 16:17:13 +0000 | [diff] [blame] | 128 | return `<details class="example"> |
| 129 | <summary><a href="${fullPath}">${example.replace('.html', '').replace(/-|_/g, ' ')}</a></summary> |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 130 | <iframe src="${fullPath}"></iframe> |
Jack Franklin | 7a75e46 | 2021-01-08 16:17:13 +0000 | [diff] [blame] | 131 | </details>`; |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 132 | }).join('\n')} |
| 133 | </body> |
| 134 | </html>`; |
| 135 | // clang-format on |
| 136 | } |
| 137 | |
| 138 | function createServerIndexFile(componentNames) { |
| 139 | // clang-format off |
| 140 | return `<!DOCTYPE html> |
| 141 | <html> |
| 142 | <head> |
| 143 | <meta charset="UTF-8" /> |
| 144 | <meta name="viewport" content="width=device-width" /> |
| 145 | <title>DevTools components</title> |
| 146 | <style> |
Jack Franklin | b599716 | 2020-11-25 17:28:51 +0000 | [diff] [blame] | 147 | a:link, a:visited { |
| 148 | color: blue; |
| 149 | text-transform: capitalize; |
| 150 | text-decoration: none; |
| 151 | } |
| 152 | a:hover { |
| 153 | text-decoration: underline; |
| 154 | } |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 155 | </style> |
| 156 | </head> |
| 157 | <body> |
| 158 | <h1>DevTools components</h1> |
| 159 | <ul> |
| 160 | ${componentNames.map(name => { |
Jack Franklin | b599716 | 2020-11-25 17:28:51 +0000 | [diff] [blame] | 161 | const niceName = name.replace(/_/g, ' '); |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 162 | return `<li><a href='/front_end/component_docs/${name}'>${niceName}</a></li>`; |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 163 | }).join('\n')} |
| 164 | </ul> |
| 165 | </body> |
| 166 | </html>`; |
| 167 | // clang-format on |
| 168 | } |
| 169 | |
| 170 | async function getExamplesForPath(filePath) { |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 171 | const componentDirectory = path.join(componentDocsBaseFolder, filePath); |
Jack Franklin | c150122 | 2020-10-02 09:42:08 +0100 | [diff] [blame] | 172 | const allFiles = await fs.promises.readdir(componentDirectory); |
| 173 | const htmlExampleFiles = allFiles.filter(file => { |
| 174 | return path.extname(file) === '.html'; |
| 175 | }); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 176 | |
Jack Franklin | c150122 | 2020-10-02 09:42:08 +0100 | [diff] [blame] | 177 | return createComponentIndexFile(filePath, htmlExampleFiles); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | function respondWithHtml(response, html) { |
| 181 | response.setHeader('Content-Type', 'text/html; charset=utf-8'); |
| 182 | response.writeHead(200); |
| 183 | response.write(html, 'utf8'); |
| 184 | response.end(); |
| 185 | } |
| 186 | |
| 187 | function send404(response, message) { |
| 188 | response.writeHead(404); |
| 189 | response.write(message, 'utf8'); |
| 190 | response.end(); |
| 191 | } |
| 192 | |
Jack Franklin | 279564e | 2020-07-06 15:25:18 +0100 | [diff] [blame] | 193 | async function checkFileExists(filePath) { |
| 194 | try { |
| 195 | const errorsAccessingFile = await fs.promises.access(filePath, fs.constants.R_OK); |
| 196 | return !errorsAccessingFile; |
| 197 | } catch (e) { |
| 198 | return false; |
| 199 | } |
| 200 | } |
| 201 | |
Jack Franklin | 9d4ecf7 | 2020-09-16 14:04:30 +0100 | [diff] [blame] | 202 | /** |
| 203 | * In Devtools-Frontend we load images without a leading slash, e.g. |
| 204 | * url(Images/checker.png). This works within devtools, but breaks this component |
Jack Franklin | 4738bc7 | 2020-09-17 09:51:24 +0100 | [diff] [blame] | 205 | * server as the path ends up as /component_docs/my_component/Images/checker.png. |
Jack Franklin | 9d4ecf7 | 2020-09-16 14:04:30 +0100 | [diff] [blame] | 206 | * So we check if the path ends in Images/*.* and if so, remove anything before |
| 207 | * it. Then it will be resolved correctly. |
| 208 | */ |
| 209 | function normalizeImagePathIfRequired(filePath) { |
| 210 | const imagePathRegex = /\/Images\/(\S+)\.(\w{3})/; |
| 211 | const match = imagePathRegex.exec(filePath); |
| 212 | if (!match) { |
| 213 | return filePath; |
| 214 | } |
| 215 | |
| 216 | const [, imageName, imageExt] = match; |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 217 | const normalizedPath = path.join('front_end', 'Images', `${imageName}.${imageExt}`); |
Jack Franklin | 9d4ecf7 | 2020-09-16 14:04:30 +0100 | [diff] [blame] | 218 | return normalizedPath; |
| 219 | } |
| 220 | |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 221 | async function requestHandler(request, response) { |
| 222 | const filePath = parseURL(request.url).pathname; |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 223 | if (filePath === '/favicon.ico') { |
| 224 | send404(response, '404, no favicon'); |
| 225 | return; |
| 226 | } |
| 227 | |
| 228 | if (filePath === '/' || filePath === '/index.html') { |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 229 | const components = await fs.promises.readdir(path.join(componentDocsBaseFolder, 'front_end', 'component_docs')); |
Jack Franklin | b599716 | 2020-11-25 17:28:51 +0000 | [diff] [blame] | 230 | const html = createServerIndexFile(components.filter(filePath => { |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 231 | const stats = fs.lstatSync(path.join(componentDocsBaseFolder, 'front_end', 'component_docs', filePath)); |
Jack Franklin | b599716 | 2020-11-25 17:28:51 +0000 | [diff] [blame] | 232 | // Filter out some build config files (tsconfig, d.ts, etc), and just list the directories. |
| 233 | return stats.isDirectory(); |
| 234 | })); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 235 | respondWithHtml(response, html); |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 236 | } else if (filePath.startsWith('/front_end/component_docs') && path.extname(filePath) === '') { |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 237 | // This means it's a component path like /breadcrumbs. |
| 238 | const componentHtml = await getExamplesForPath(filePath); |
| 239 | respondWithHtml(response, componentHtml); |
Jack Franklin | 3642900 | 2020-11-25 15:07:26 +0000 | [diff] [blame] | 240 | return; |
| 241 | } else if (/component_docs\/(.+)\/(.+)\.html/.test(filePath)) { |
| 242 | /** This conditional checks if we are viewing an individual example's HTML |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 243 | * file. e.g. localhost:8090/front_end/component_docs/data_grid/basic.html For each |
Jack Franklin | 3642900 | 2020-11-25 15:07:26 +0000 | [diff] [blame] | 244 | * example we inject themeColors.css into the page so all CSS variables |
| 245 | * that components use are available. |
| 246 | */ |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 247 | |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 248 | /** |
| 249 | * We also let the user provide a different base path for any shared |
| 250 | * resources that we load. But if this is provided along with the |
| 251 | * componentDocsBaseArg, and the two are the same, we don't want to use the |
| 252 | * shared resources base, as it's part of the componentDocsBaseArg and |
| 253 | * therefore the URL is already correct. |
| 254 | * |
| 255 | * If we didn't get a componentDocsBaseArg or we did and it's different to |
| 256 | * the sharedResourcesBase, we use sharedResourcesBase. |
| 257 | */ |
| 258 | const baseUrlForSharedResource = |
| 259 | componentDocsBaseArg && componentDocsBaseArg.endsWith(sharedResourcesBase) ? '/' : `/${sharedResourcesBase}`; |
| 260 | const fileContents = await fs.promises.readFile(path.join(componentDocsBaseFolder, filePath), {encoding: 'utf8'}); |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 261 | const themeColoursLink = `<link rel="stylesheet" href="${ |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 262 | path.join(baseUrlForSharedResource, 'front_end', 'ui', 'themeColors.css')}" type="text/css" />`; |
Jack Franklin | 343c141 | 2021-02-26 15:08:10 +0000 | [diff] [blame] | 263 | const inspectorCommonLink = `<link rel="stylesheet" href="${ |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 264 | path.join(baseUrlForSharedResource, 'front_end', 'ui', 'inspectorCommon.css')}" type="text/css" />`; |
Jack Franklin | 8742dc8 | 2021-02-26 09:17:59 +0000 | [diff] [blame] | 265 | const toggleDarkModeScript = `<script type="module" src="${ |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 266 | path.join(baseUrlForSharedResource, 'front_end', 'component_docs', 'component_docs.js')}"></script>`; |
Jack Franklin | 343c141 | 2021-02-26 15:08:10 +0000 | [diff] [blame] | 267 | const newFileContents = fileContents.replace('<style>', `${themeColoursLink}\n${inspectorCommonLink}\n<style>`) |
Jack Franklin | 3642900 | 2020-11-25 15:07:26 +0000 | [diff] [blame] | 268 | .replace('<script', toggleDarkModeScript + '\n<script'); |
| 269 | respondWithHtml(response, newFileContents); |
| 270 | |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 271 | } else { |
Jack Franklin | 9d4ecf7 | 2020-09-16 14:04:30 +0100 | [diff] [blame] | 272 | // This means it's an asset like a JS file or an image. |
| 273 | const normalizedPath = normalizeImagePathIfRequired(filePath); |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 274 | |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 275 | let fullPath = path.join(componentDocsBaseFolder, normalizedPath); |
Jack Franklin | d034512 | 2020-12-21 09:12:04 +0000 | [diff] [blame] | 276 | if (fullPath.endsWith(path.join('locales', 'en-US.json'))) { |
| 277 | // Rewrite this path so we can load up the locale in the component-docs |
Jack Franklin | 0155f7d | 2021-03-02 09:11:22 +0000 | [diff] [blame] | 278 | fullPath = path.join(componentDocsBaseFolder, 'front_end', 'i18n', 'locales', 'en-US.json'); |
Jack Franklin | d034512 | 2020-12-21 09:12:04 +0000 | [diff] [blame] | 279 | } |
| 280 | |
Jack Franklin | 90b6613 | 2021-01-05 11:33:43 +0000 | [diff] [blame] | 281 | if (!fullPath.startsWith(devtoolsRootFolder) && !fileIsInTestFolder) { |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 282 | console.error(`Path ${fullPath} is outside the DevTools Frontend root dir.`); |
| 283 | process.exit(1); |
| 284 | } |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 285 | |
Jack Franklin | 279564e | 2020-07-06 15:25:18 +0100 | [diff] [blame] | 286 | const fileExists = await checkFileExists(fullPath); |
| 287 | |
| 288 | if (!fileExists) { |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 289 | send404(response, '404, File not found'); |
| 290 | return; |
| 291 | } |
| 292 | |
| 293 | let encoding = 'utf8'; |
Mathias Bynens | c38abd4 | 2020-12-24 08:20:05 +0100 | [diff] [blame] | 294 | if (fullPath.endsWith('.wasm') || fullPath.endsWith('.png') || fullPath.endsWith('.jpg') || |
| 295 | fullPath.endsWith('.avif')) { |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 296 | encoding = 'binary'; |
| 297 | } |
| 298 | |
| 299 | const fileContents = await fs.promises.readFile(fullPath, encoding); |
| 300 | |
| 301 | encoding = 'utf8'; |
| 302 | if (fullPath.endsWith('.js')) { |
| 303 | response.setHeader('Content-Type', 'text/javascript; charset=utf-8'); |
| 304 | } else if (fullPath.endsWith('.css')) { |
| 305 | response.setHeader('Content-Type', 'text/css; charset=utf-8'); |
| 306 | } else if (fullPath.endsWith('.wasm')) { |
| 307 | response.setHeader('Content-Type', 'application/wasm'); |
| 308 | encoding = 'binary'; |
| 309 | } else if (fullPath.endsWith('.svg')) { |
| 310 | response.setHeader('Content-Type', 'image/svg+xml; charset=utf-8'); |
| 311 | } else if (fullPath.endsWith('.png')) { |
| 312 | response.setHeader('Content-Type', 'image/png'); |
| 313 | encoding = 'binary'; |
| 314 | } else if (fullPath.endsWith('.jpg')) { |
| 315 | response.setHeader('Content-Type', 'image/jpg'); |
| 316 | encoding = 'binary'; |
Mathias Bynens | c38abd4 | 2020-12-24 08:20:05 +0100 | [diff] [blame] | 317 | } else if (fullPath.endsWith('.avif')) { |
| 318 | response.setHeader('Content-Type', 'image/avif'); |
| 319 | encoding = 'binary'; |
Jack Franklin | 1557a1c | 2020-06-08 15:22:13 +0100 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | response.writeHead(200); |
| 323 | response.write(fileContents, encoding); |
| 324 | response.end(); |
| 325 | } |
| 326 | } |