i applied to use a dictionary API and it was asked the URL which i would be using it, i choosed locahost:19006, because it's where the local server is opening. And i have the API key, but for some reason i'm having CORS issue. So i'm trying to fetch it through a proxy server, but i'm receiving this error:
Error: AxiosError: unable to verify the first certificate
at TLSSocket.onConnectSecure (node:_tls_wrap:1530:34)
at TLSSocket.emit (node:events:390:28)
at TLSSocket._finishInit (node:_tls_wrap:944:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:725:12) {
code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
This is the proxyServer.js:
const app = express();
app.use(cors());
const https = require("https");
const agent = new https.Agent({
rejectUnauthorized: false,
});
app.get("/words", async (req, res) => {
await axios
.get(
`https://krdict.korean.go.kr/api/search?certkey_no=4013&key=${API_KEY}&type_search=search&part=word&q=%EB%82%98%EB%AC%B4&sort=dict`,
{ agent }
)
.then((response) => {
console.log("Response:", response.data);
})
.catch((error) => console.log("Error:", error));
});
app.listen(3000, () => console.log("listening on port 3000"));
Does anyone know how to solve it?