Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update description & remove sleep #2

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading