UNPKG

zyf-server

Version:

A modern HTTP static file server with Vue SSR directory listing, built for developers

47 lines 1.29 kB
"use strict"; /** * TypeScript版本的简化入口文件 * 用于测试和验证TypeScript重构 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultConfig = void 0; exports.start = start; const Server_1 = require("./server/Server"); const Logger_1 = require("./utils/Logger"); const logger = new Logger_1.Logger('Main'); // 创建默认配置 const defaultConfig = { port: 3000, host: 'localhost', dir: process.cwd(), open: true, compression: true, cache: { maxAge: 10, etag: true, lastModified: true, }, }; exports.defaultConfig = defaultConfig; /** * 启动服务器 */ async function start() { try { logger.info('🚀 Starting TypeScript HTTP Server...'); const server = new Server_1.Server(defaultConfig); await server.start(); logger.info('✅ Server started successfully!'); logger.info(`📁 Serving directory: ${defaultConfig.dir}`); logger.info(`🌐 URL: http://${defaultConfig.host}:${defaultConfig.port}`); } catch (error) { logger.error('❌ Failed to start server:', error); process.exit(1); } } // 如果直接运行这个文件 if (require.main === module) { start(); } //# sourceMappingURL=index.js.map