-
Notifications
You must be signed in to change notification settings - Fork 4
/
mod.ts
32 lines (27 loc) · 863 Bytes
/
mod.ts
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
32
import { DenoKVRepository } from "@friendsofshopware/app-server/service/deno";
import { configureAppServer } from "@friendsofshopware/app-server/framework/hono";
import { Hono } from "hono";
import type {
AppServer,
Context,
ShopInterface,
} from "@friendsofshopware/app-server";
import { createNotificationResponse } from "@friendsofshopware/app-server/helper/app-actions";
const app = new Hono();
declare module "hono" {
interface ContextVariableMap {
app: AppServer;
shop: ShopInterface;
context: Context;
}
}
app.post('/app/action-button/product', async ctx => {
console.log(`Got request from Shop ${ctx.get('shop').getShopId()}`)
return createNotificationResponse('success', 'YEAA');
});
configureAppServer(app, {
appName: 'SwagTest',
appSecret: 'SwagTest',
shopRepository: new DenoKVRepository(),
})
export default app;