Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
const axios = require('axios');
|
|
|
|
async function testRoutes() {
|
|
console.log('测试不同的路由...\n');
|
|
|
|
// 测试几个路由
|
|
const routes = [
|
|
{ method: 'GET', path: '/' },
|
|
{ method: 'POST', path: '/login' },
|
|
{ method: 'POST', path: '/admin/info' },
|
|
{ method: 'GET', path: '/admin/info' },
|
|
];
|
|
|
|
for (const route of routes) {
|
|
try {
|
|
console.log(`测试 ${route.method} ${route.path}`);
|
|
const config = {
|
|
method: route.method,
|
|
url: `http://localhost:3000${route.path}`,
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
}
|
|
};
|
|
|
|
const res = await axios(config);
|
|
console.log(` 状态: ${res.status}`);
|
|
console.log(` Content-Type: ${res.headers['content-type']}`);
|
|
if (typeof res.data === 'string' && res.data.includes('404')) {
|
|
console.log(` 响应: 404页面`);
|
|
} else {
|
|
console.log(` 响应:`, JSON.stringify(res.data).substring(0, 100));
|
|
}
|
|
} catch (error) {
|
|
if (error.response) {
|
|
console.log(` 错误: 状态码 ${error.response.status}`);
|
|
} else {
|
|
console.log(` 错误: ${error.message}`);
|
|
}
|
|
}
|
|
console.log('');
|
|
}
|
|
}
|
|
|
|
testRoutes(); |