mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2024-11-22 13:32:42 +01:00
Merge pull request #401 from Mjokfox/api/add_cors
Add cors to the express api
This commit is contained in:
commit
ac949dc211
@ -42,6 +42,7 @@
|
||||
"@electron/remote": "^2.1.2",
|
||||
"@types/swagger-jsdoc": "^6.0.4",
|
||||
"axios": "^1.6.8",
|
||||
"cors": "^2.8.5",
|
||||
"discord-rpc": "^4.0.1",
|
||||
"electron-store": "^8.2.0",
|
||||
"express": "^4.19.2",
|
||||
@ -54,6 +55,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mastermindzh/prettier-config": "^1.0.0",
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/discord-rpc": "^4.0.8",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.10.6",
|
||||
@ -77,4 +79,4 @@
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"prettier": "@mastermindzh/prettier-config"
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import { addCurrentInfo } from "./features/current";
|
||||
import { addPlaybackControl } from "./features/player";
|
||||
import { addSettingsAPI } from "./features/settings/settings";
|
||||
import { addLegacyApi } from "./legacy";
|
||||
import cors from "cors";
|
||||
|
||||
/**
|
||||
* Function to enable TIDAL Hi-Fi's express api
|
||||
@ -44,6 +45,7 @@ export const startApi = (mainWindow: BrowserWindow) => {
|
||||
});
|
||||
|
||||
const expressApp = express();
|
||||
expressApp.use(cors());
|
||||
expressApp.use(express.json());
|
||||
expressApp.use("/docs", swaggerUi.serve, swaggerUi.setup(specs));
|
||||
expressApp.get("/", (req, res) => res.send("Hello World!"));
|
||||
|
Loading…
Reference in New Issue
Block a user