Spaces:
Running
Running
Download server.js from Lunaron/lunaron-tools: direct link, hf CLI and curl.
- Browser
- Download file 1.6 kB
-
https://huggingface.co/spaces/Lunaron/lunaron-tools/resolve/main/server.js
- Command line
-
hf download hf://spaces/Lunaron/lunaron-tools/server.js
-
curl -L -o server.js https://huggingface.co/spaces/Lunaron/lunaron-tools/resolve/main/server.js
1.6 kB
| require('dotenv').config(); | |
| const express = require('express'); | |
| const path = require('path'); | |
| const helmet = require('helmet'); | |
| const rateLimit = require('express-rate-limit'); | |
| const { handleStripeWebhook } = require('./backend/stripeWebhook'); | |
| const app = express(); | |
| const port = process.env.PORT || 3000; | |
| // セキュリティヘッダーの設定 (Consolidated) | |
| // app.use(helmet({ ... })); // Temporarily disabled for debugging | |
| app.use(express.json()); | |
| app.use(express.static(__dirname)); | |
| // app.use((req, res, next) => { ... }); // Whitelist disabled for debugging | |
| // --- APIルート --- | |
| // 画像圧縮API | |
| app.post('/api/compress-image', (req, res) => { | |
| // backend/imageCompressor.ts のロジックを呼び出す (実際にはWorkerやQueueを使用推奨) | |
| res.json({ message: "画像圧縮リクエストを受け付けました" }); | |
| }); | |
| // エラーハンドリング | |
| app.use((err, req, res, next) => { | |
| console.error(err.stack); | |
| res.status(500).send('Something broke!'); | |
| }); | |
| // サーバー起動 | |
| app.listen(port, '0.0.0.0', () => { | |
| console.log(`-----------------------------------------------`); | |
| printMoon(); | |
| console.log(` Lunaron Tools Server is running!`); | |
| console.log(` Port: ${port}`); | |
| console.log(` Mode: ${process.env.NODE_ENV || 'development'}`); | |
| console.log(`-----------------------------------------------`); | |
| }); | |
| function printMoon() { | |
| console.log(" .---. "); | |
| console.log(" / . \\ "); | |
| console.log(" | . | "); | |
| console.log(" \\ ' / "); | |
| console.log(" '---' "); | |
| } | |