admin管理员组文章数量:1122846
i am having issue with deploying my solana blink and make uref on X in express js. how do i go about the action.json file in express js, most tutorial are in next js
i have a action.ts file in the root of the application,
see what i have odne so far ..
import { ActionsJson, ACTIONS_CORS_HEADERS } from '@solana/actions';
import { Request, Response, NextFunction } from 'express';
import express from 'express';
const router = express.Router();
export const GET = async (req: Request, res: Response, next: NextFunction) => {
try {
const payload: ActionsJson = {
rules: [
{
pathPattern: '/example-path',
apiPath: '/api/endpoint',
},
],
};
// Set CORS headers for the response
Object.entries(ACTIONS_CORS_HEADERS).forEach(([key, value]) => {
res.setHeader(key, value);
});
// Respond with JSON payload
res.status(200).json(payload);
} catch (error) {
next(error);
}
};
export const OPTIONS = (req: Request, res: Response) => {
// Set CORS headers for preflight response
Object.entries(ACTIONS_CORS_HEADERS).forEach(([key, value]) => {
res.setHeader(key, value);
});
res.sendStatus(204);
};
// route
router.get('/api/actions', GET);
export default router;``
本文标签: solana actions and blinks in express jsStack Overflow
版权声明:本文标题:solana actions and blinks in express js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309735a1934124.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论