1.0.18 • Published 2 months ago

@written/wrap v1.0.18

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

Written Logo

@written/wrap

Create a wrapper (primitive "middleware") around an Appwrite Function. It's recommended to just use @written/app.

Codeberg License

Installation

pnpm i @written/wrap @written/appwrite-types

Usage

// wrapper.ts
import wrap from '@written/wrap';
export default wrap((ctx, rs) => {
  rs.headers['x-abc'] = ctx.req.headers['x-abc'] ?? '';
  return rs;
});

This example middleware will replace the x-abc header in the response with the same header as found in the request.

You can then use it as such:

import w from './wrapper';
export default w(ctx => {
  return ctx.res.json({
    success: 1,
    message: 'Hi!',
  });
});
1.0.18

2 months ago

1.0.17

2 months ago

1.0.16

2 months ago

1.0.15

2 months ago

1.0.14

2 months ago

1.0.13

3 months ago

1.0.12

3 months ago

1.0.11

3 months ago

1.0.10

4 months ago

1.0.9

4 months ago

1.0.8

4 months ago

1.0.7

4 months ago

1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

5 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

0.1.5

6 months ago

0.1.4

6 months ago

0.1.3

6 months ago

0.1.2

6 months ago

0.1.1

6 months ago