1.0.18 • Published 1 year ago

@written/wrap v1.0.18

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year 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

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago