mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
feat: webui Login Router
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import express from 'express';
|
||||
import { resolve } from 'node:path';
|
||||
import { APIRouter } from './src/router';
|
||||
const app = express();
|
||||
/**
|
||||
* 初始化并启动WebUI服务。
|
||||
@@ -9,8 +10,16 @@ const app = express();
|
||||
*/
|
||||
export async function InitWebUi() {
|
||||
app.use(express.json());
|
||||
// 初始服务
|
||||
app.all('/', (_req, res) => {
|
||||
res.json({
|
||||
msg: 'NapCat WebAPI is now running!',
|
||||
});
|
||||
});
|
||||
// 配置静态文件服务,提供./static目录下的文件服务,访问路径为/webui
|
||||
app.use('/webui', express.static(resolve(__dirname, './static')));
|
||||
//挂载API接口
|
||||
app.all('/api', APIRouter);
|
||||
app.listen(6099, async () => {
|
||||
//console.log(`WebUi is running at IP:6099`);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user