Skip to content

Commit

Permalink
Merge pull request #2 from BunnyWay/misc-update-description
Browse files Browse the repository at this point in the history
Update description & remove sleep
  • Loading branch information
antho-bunny authored Sep 9, 2024
2 parents cc1a45f + 20ab5d0 commit 26bdc7f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/great-humans-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"es-return-json": patch
---

Remove the useless sleep on request
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 1 addition & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import * as BunnySDK from "https://esm.sh/@bunny.net/[email protected]";
import sample from "../assets/sample.json" with { type: "json" };

function sleep(ms: number): Promise<void> {
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<Response> => {
console.log(`[INFO]: ${req.method} - ${req.url}`);
await sleep(1);
const json = JSON.stringify(sample);
return new Response(json, {
headers: {
Expand Down

0 comments on commit 26bdc7f

Please sign in to comment.