diff --git a/.changeset/great-humans-approve.md b/.changeset/great-humans-approve.md new file mode 100644 index 0000000..9f566ad --- /dev/null +++ b/.changeset/great-humans-approve.md @@ -0,0 +1,5 @@ +--- +"es-return-json": patch +--- + +Remove the useless sleep on request diff --git a/README.md b/README.md index c4c75e1..64ce8a7 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,26 @@ We also use `pnpm` to use `changeset`. ## Changeset -In this template, we handle versionning with [changeset](https://github.com/changesets/changesets), -each time you do a change, you'll need to indicate the kind of changes you are -doing so we can have the auto-release process ongoing by doing: +This template uses [changeset](https://github.com/changesets/changesets) for +version management. Changeset helps track and document changes in your project, +making it easier to manage releases and generate changelogs. -``` -pnpm changeset -``` +When you make changes to the project, you should create a changeset to describe +those changes: + +1. Run the following command: + ``` + pnpm changeset + ``` +2. Follow the prompts to select the type of change (major, minor, or patch) and provide a brief description. +3. Commit the generated changeset file along with your code changes. + +This process ensures that all modifications are properly documented and +versioned, facilitating smoother releases and better communication about +project updates. + +When you merge a pull request that includes a changeset, it will automatically +create an associated pull request to release your changes. + +This new pull request will trigger the release process of the script to your +PullZone in Bunny. diff --git a/src/main.ts b/src/main.ts index a466ce7..99e5a62 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,18 +1,13 @@ import * as BunnySDK from "https://esm.sh/@bunny.net/edgescript-sdk@0.10.0"; import sample from "../assets/sample.json" with { type: "json" }; -function sleep(ms: number): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - console.log("Starting server..."); const listener = BunnySDK.net.tcp.unstable_new(); console.log("Listening on: ", BunnySDK.net.tcp.toString(listener)); BunnySDK.net.http.serve( - async (req) => { + (req: Request): Response | Promise => { console.log(`[INFO]: ${req.method} - ${req.url}`); - await sleep(1); const json = JSON.stringify(sample); return new Response(json, { headers: {