Skip to content

Commit

Permalink
move the gettin started guide to pages folder
Browse files Browse the repository at this point in the history
  • Loading branch information
afzal442 committed Dec 1, 2023
1 parent 9783049 commit f9d535a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export default async function (event) {
}]
}
}
```

#### Run the Development Server

Expand Down
11 changes: 6 additions & 5 deletions docs/pages/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ We recommend creating a new Glee app using our official CLI which sets up everyt

Once the process is completed, you should have a new Glee app ready for development and see these files that were made.

![glee_structure](/assets/glee_struct.png)
![glee_structure](glee_struct.png)

#### Define our Spec for our API

Expand Down Expand Up @@ -106,7 +106,7 @@ components:

This will be the Specification that defines our API, in our case, it is very simple, as we will be sending a name and the time of the day, and our API will greet us accordingly.

One thing to note here is the `operationId`, this is needed and is a crucial part of glee, as this is how we will be connecting our business logic with our spec, `operationId` is the name of the function that will be called every time a certain operation occurs. In our case whenever `/greet` channel received a message.
One thing to note here is the `operations` item, this is needed and is a crucial part of glee, as this is how we will be connecting our business logic with our spec, `onGreet` is the name of the function that will be called every time a certain operation occurs. In our case whenever `/greet` channel receives a message, `onGreet` function is called.

#### Define our operation function

Expand Down Expand Up @@ -138,10 +138,11 @@ export default async function (event) {

Every file in the functions folder acts as a handler to develop business logic for glee, every file should export an async function that receives an event parameter, where you have access to payload and server details.

Running and testing your application
#### Running and testing your application

We will not execute the application and carry out testing with Postman to ensure that it is functioning as intended.

Now to run your glee application, just run:
Now to execute your glee application, just run:

```
npm run dev
Expand All @@ -150,6 +151,6 @@ npm run start
```
To send a WebSocket request with a payload e.g. `{"name":"john", "time": "1567906535"}` to `ws://localhost:3000/greet`, open Postman and checkout the endpoint:

![glee_response](/assets/glee_resp.png)
![glee_response](glee_resp.png)

So, this is how easy it is to build a WebSocket API using Glee. You can also check out the example code [here](https://github.com/Souvikns/greet-bot).

0 comments on commit f9d535a

Please sign in to comment.