Skip to content

Commit

Permalink
chore(docs): lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Mar 1, 2023
1 parent a4b8fb8 commit 45c0b38
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions docs/content/4.http-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Request url is mapped to key and method/body mapped to function. See below for s

Programmatic usage of creating an HTTP server exposing methods to communicate with the `storage` instance:

```js[server.js]
```js [server.js]
import { listen } from "listhen";
import { createStorage } from "unstorage";
import { createStorageServer } from "unstorage/server";
Expand All @@ -22,7 +22,6 @@ await listen(storageServer.handle);

The `storageServer` is an [h3](https://github.com/unjs/h3) instance. Checkout also [listhen](https://github.com/unjs/listhen) for an elegant HTTP listener.


::alert{type="primary"}
**🛡️ Security Note:** The server is unprotected by default. You need to add your own authentication/security middleware like basic authentication.
Also consider that even with authentication, `unstorage` should not be exposed to untrusted users since it has no protection for abuse (DDOS, Filesystem escalation, etc)
Expand All @@ -38,10 +37,10 @@ import httpDriver from "unstorage/drivers/http";

const client = createStorage({
driver: httpDriver({
base: 'SERVER_ENDPOINT',
base: "SERVER_ENDPOINT",
}),
})
const keys = await client.getKeys()
});
const keys = await client.getKeys();
```

## HTTP Methods
Expand All @@ -53,4 +52,4 @@ const keys = await client.getKeys()

::alert{type="info"}
When passing `accept: application/octet-stream` for GET and SET operations, the server switches to binary mode via `getItemRaw` and `setItemRaw`.
::
::

0 comments on commit 45c0b38

Please sign in to comment.