Skip to content

Commit

Permalink
fix: improve glee default template (#946)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukasz Gornicki <[email protected]>%0ACo-authored-by: souvik <[email protected]>
  • Loading branch information
KhudaDad414 and Souvikns authored Apr 18, 2024
1 parent f040d75 commit f5f281e
Show file tree
Hide file tree
Showing 7 changed files with 2,943 additions and 11,225 deletions.
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
7 changes: 0 additions & 7 deletions assets/create-glee-app/templates/default/functions/onHello.js

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

0 comments on commit f5f281e

Please sign in to comment.