Skip to content

Instantly share code, notes, and snippets.

@ezzabuzaid
Last active August 13, 2024 12:31
Show Gist options
  • Save ezzabuzaid/f34aca124fe48eabad26fbf4927e59fc to your computer and use it in GitHub Desktop.
Save ezzabuzaid/f34aca124fe48eabad26fbf4927e59fc to your computer and use it in GitHub Desktop.
projectName extensions
HTTP trigger project
core,identity,hono,fly,postgresql
export default project(
	feature('Users', {
		tables: {
			users: table({
				fields: {
					name: field({ type: 'short-text' }),
					email: field({ type: 'email' }),
				},
			}),
		},
		workflows: [
			workflow('CreateUserWorkflow', {
				tag: 'users',
				trigger: trigger.http({
					method: 'post',
					path: '/',
				}),
				actions: {
					createUser: action.database.insert({
						table: useTable('users'),
						columns: [
							useField('name', '@trigger:body.name'),
							useField('email', '@trigger:body.email'),
						],
					}),
				},
			}),
		],
	})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment