forked from MuGuiLin/VoiceDictation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (25 loc) · 800 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const express = require('express');
const app = express();
const path = require('path');
const dotenv = require('dotenv');
// 加载 .env 文件中的环境变量
dotenv.config();
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
// 创建一个新的端点,用于返回环境变量
app.get('/env', (req, res) => {
res.json({
appId: process.env.XF_APP_ID,
apiSecret: process.env.XF_API_SECRET,
apiKey: process.env.XF_API_KEY,
base_url: process.env.AI_BASE_URL,
api_key: process.env.AI_API_KEY,
model_name: process.env.AI_MODEL_NAME,
});
});
const PORT = process.env.PORT || 21132;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});