Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve glee default template #946

Merged
merged 11 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ spec-examples.zip
# Coverage for testing

coverage

# Glee
assets/create-glee-app/templates/default/.glee
assets/create-glee-app/templates/tutorial/.glee
assets/create-glee-app/templates/default/docs
assets/create-glee-app/templates/tutorial/docs
16 changes: 15 additions & 1 deletion assets/create-glee-app/templates/default/README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ This is a [Glee](https://github.com/asyncapi/glee) project bootstrapped with the

## Getting Started

First, run the development server:
1) Install Dependencies:

```bash
npm install --ignore-scripts
```



2) run the development server:

```bash
npm run dev
```

3) send some text to the websocket server at `ws://0.0.0.0:3000/hello`

```bash
websocat ws://0.0.0.0:3000/hello
Hi!
```
You can start editing the API by modifying `functions/onHello.js` and `asyncapi.yaml`. The server auto-updates as you edit the file.

## Learn More
Expand Down
11 changes: 6 additions & 5 deletions assets/create-glee-app/templates/default/asyncapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ servers:
protocol: ws
channels:
hello:
address: hello
address: /hello
messages:
hello:
$ref: '#/components/messages/hello'
Expand All @@ -17,11 +17,12 @@ operations:
action: receive
channel:
$ref: '#/channels/hello'
reply:
channel:
$ref: '#/channels/hello'
sendHello:
action: send
channel:
$ref: '#/channels/hello'
components:
messages:
hello:
payload:
type: string
type: string

This file was deleted.

11 changes: 11 additions & 0 deletions assets/create-glee-app/templates/default/functions/onHello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { GleeFunctionReturn } from "@asyncapi/glee"

export default async function (event): Promise<GleeFunctionReturn> {
return {
send: [{
payload: `Hello from Glee! You said: '${event.payload}'.`,
channel: "hello",
server: "websockets"
}]
}
}
Loading
Loading