From f9d535a167511fd3b6f6e8dc89932827b70684c6 Mon Sep 17 00:00:00 2001 From: Afzal Ansari Date: Fri, 1 Dec 2023 17:38:38 +0000 Subject: [PATCH] move the gettin started guide to pages folder --- {assets => docs/pages}/glee_resp.png | Bin {assets => docs/pages}/glee_struct.png | Bin docs/pages/index.md | 1 + docs/pages/introduction.md | 11 ++++++----- 4 files changed, 7 insertions(+), 5 deletions(-) rename {assets => docs/pages}/glee_resp.png (100%) rename {assets => docs/pages}/glee_struct.png (100%) diff --git a/assets/glee_resp.png b/docs/pages/glee_resp.png similarity index 100% rename from assets/glee_resp.png rename to docs/pages/glee_resp.png diff --git a/assets/glee_struct.png b/docs/pages/glee_struct.png similarity index 100% rename from assets/glee_struct.png rename to docs/pages/glee_struct.png diff --git a/docs/pages/index.md b/docs/pages/index.md index 1918676e7..fd062f103 100644 --- a/docs/pages/index.md +++ b/docs/pages/index.md @@ -123,6 +123,7 @@ export default async function (event) { }] } } +``` #### Run the Development Server diff --git a/docs/pages/introduction.md b/docs/pages/introduction.md index 551e885b5..55bc696e9 100644 --- a/docs/pages/introduction.md +++ b/docs/pages/introduction.md @@ -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 @@ -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 @@ -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 @@ -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).