Koii.

帖子

分享您的知识。

Christian O'Connor.
May 16, 2023
专家问答

I'm building a static app that uses serverless functions. Could Koii tasks provide the functions?

I have a next.js app that has 1 function in the pages/api route. I need to remove this to make the app capable of being deployed to IPFS as a static site. This function contains some code and parameters that shouldn't be accessible to the browser so I can't just add the function to a page. Could I replace my pages/api route with a Koii task?

For example let's say I had a next.js app with a button that downloads a file from IPFS when clicked. I want to keep the IPFS CID a secret to the end user, therefore, I can't simply add this function to the page. Could I make a Koii task that fetches and streams this file to the browser for download?

  • Koii Network
  • Task
  • Koii-X
1
1
分享
评论
.

答案

1
0xc323...9980.
May 30 2023, 18:49

Yes, you can utilize Koii tasks to handle sensitive operations and protect your code and parameters from being accessible to the browser. In your scenario, where you want to remove a function in the pages/api route to make your app deployable to IPFS as a static site, you can consider using a Koii task to achieve the desired functionality.

Instead of directly exposing the function in the pages/api route, you can create a Koii task that fetches and streams the file from IPFS to the browser for download. This way, the sensitive code and parameters will remain secure within the Koii task environment and won't be exposed to the end user.

To implement this, you can define a Koii task that performs the necessary operations to fetch and stream the file from IPFS. You can pass any required parameters securely to the task, ensuring that they are not exposed to the browser. The task can then generate the appropriate response that allows the user to download the file without revealing the IPFS CID or other sensitive information.

By leveraging Koii tasks, you can maintain the desired level of security while providing the necessary functionality to download files from IPFS in your Next.js app.

0
最佳答案
评论
.
Christian O'Connor.
May 31 2023, 00:28

That is exactly what I'm looking for, thanks! Also, I'm looking to hire someone to implement this. If you're interested or know anyone who would be, please send them my way.

你知道答案吗?

请登录并分享。

我们使用 cookie 确保您在我们的网站上获得最佳体验。
更多信息