https://github.com/hyper63/zap
https://github.com/hyper63/zap
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/hyper63/zap
- Owner: hyper63
- Created: 2021-03-05T18:51:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-05T20:32:45.000Z (over 5 years ago)
- Last Synced: 2025-03-02T18:31:55.955Z (over 1 year ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```