express/LINEWORKS_Pleasanter/LINEWORKS_sendMessage、いずれも過去の Express実装。Gitea移行に伴い保管。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
34 lines
985 B
JavaScript
34 lines
985 B
JavaScript
const express = require('express');
|
|
const https = require('https');
|
|
const { SSL_OPTIONS } = require('./config.js');
|
|
|
|
const app = express();
|
|
|
|
app.use((req, res, next) => {
|
|
console.log(`[${new Date().toISOString()}] ${req.method} ${req.originalUrl}`);
|
|
next();
|
|
});
|
|
|
|
app.use(express.json());
|
|
app.use(express.urlencoded({ extended: true }));
|
|
|
|
app.get('/webhook', (req, res) => {
|
|
console.log('GET /webhook headers:', req.headers);
|
|
res.status(200).send('ok');
|
|
});
|
|
|
|
app.head('/webhook', (req, res) => {
|
|
console.log('HEAD /webhook headers:', req.headers);
|
|
res.status(200).end();
|
|
});
|
|
|
|
app.post('/webhook', (req, res) => {
|
|
console.log('POST /webhook headers:', req.headers);
|
|
console.log('POST /webhook body:', req.body);
|
|
res.status(200).json({ message: 'Webhook received' });
|
|
});
|
|
|
|
const PORT = 30399;
|
|
https.createServer(SSL_OPTIONS, app).listen(PORT, '0.0.0.0', () => {
|
|
console.log(`Webhook HTTPS server running on https://neo999.next-hd.net:${PORT}`);
|
|
}); |