Skip to content

Instantly share code, notes, and snippets.

@ezzabuzaid
Created July 30, 2024 07:55
Show Gist options
  • Save ezzabuzaid/1329d7ff4f424e85c43677f9017e5286 to your computer and use it in GitHub Desktop.
Save ezzabuzaid/1329d7ff4f424e85c43677f9017e5286 to your computer and use it in GitHub Desktop.
---
projectName: "HTTP trigger project"
extensions: "core,identity,hono,fly,postgresql"
---
```ts
export default project(
feature('InventoryFeature', {
policies: {
cambodiaClient: policy.country('Cambodia'),
},
tables: {
items: table({
fields: {
name: field({ type: 'short-text' }),
price: field({ type: 'integer' }),
},
}),
},
workflows: [
workflow('PurchaseItem', {
tag: 'items',
trigger: trigger.http({
policies: ['cambodiaClient'],
method: 'post',
path: '/',
}),
actions: {
purchaseItem: (trigger) =>
action.database.insert({
table: useTable('items'),
columns: [useField('name', trigger.body.name)],
}),
},
}),
],
});
);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment