An open API service indexing awesome lists of open source software.

https://github.com/hyper63/zap


https://github.com/hyper63/zap

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# README

`zap` a react web server framework built on top of opine. This server framework,
lets you create APIs using react for the server.

```js
import React from "react";
import { App, Request, run, Use } from "zap";

const Hello = ({ req, res }) => (res.json({ hello: "world" }), null);

run(





,
);
```

In Deno, create an import_map.json file

```json
{
"imports": {
"react": "https://cdn.skypack.dev/react?dts",
"zap": "https://x.nest.land/zap@0.0.3/mod.js"
}
}
```

## API

### App

Is a wrapper for your application.

```

...

```

### Use

allows you to use middleware, this middleware must have a `fn` that handles `(req, res, next)`

Props

* path [optional] - the path to run the middleware on, default is '*'
* fn - the middleware function handler

```

```

### Request

Defines the request path for the api.

Props

* path - the request path
* method - the request method to handle

``` jsx

```

### Listen

the Listen component takes the port the server will listen

``` jsx

```