Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/zce/locally-server

A JSON file RESTful API based on json-server for zce/weapp-locally & zce/quickapp-locally
https://github.com/zce/locally-server

json-api json-server now now-sh rest-api restful

Last synced: about 1 month ago
JSON representation

A JSON file RESTful API based on json-server for zce/weapp-locally & zce/quickapp-locally

Awesome Lists containing this project

README

        

# locally-server

[![Build Status][travis-image]][travis-url]
[![Dependency Status][dependency-image]][dependency-url]
[![devDependency Status][devdependency-image]][devdependency-url]
[![Code Style][style-image]][style-url]

> A JSON file RESTful API with authorization based on [json-server](https://github.com/typicode/json-server) for [zce/weapp-locally](https://github.com/zce/weapp-locally) & [zce/quickapp-locally](https://github.com/zce/quickapp-locally)

## Usage

```sh
# clone repo
$ git clone https://github.com/zce/locally-server.git

# change directory
$ cd

# install dependencies
$ yarn # or npm install
```

modify [database.json](database.json) file

```sh
# serve with hot reload at http://localhost:3000
$ yarn dev
```

## JSON Server Resources Endpoints

- Slides: `/slides/:id?`
- Categories: `/categories/:id?`
- Shops: `/shops/:id?`

To access and modify resources, you can use any HTTP method: `GET` `POST` `PUT` `PATCH` `DELETE` `OPTIONS`

## Backdoor Endpoints

### GET `/backdoor/delay`

add a delay of 1000ms for each endpoint

```sh
$ curl http://localhost:3000/backdoor/delay
```

## Related

- [zce/dashboard-server](https://github.com/zce/dashboard-server) - A JSON file RESTful API with JWT authorization based on json-server for [zce/dashboard](https://github.com/zce/dashboard)

## License

[MIT](LICENSE) © [汪磊](https://zce.me)

[travis-image]: https://img.shields.io/travis/zce/locally-server.svg
[travis-url]: https://travis-ci.org/zce/locally-server
[dependency-image]: https://img.shields.io/david/zce/locally-server.svg
[dependency-url]: https://david-dm.org/zce/locally-server
[devdependency-image]: https://img.shields.io/david/dev/zce/locally-server.svg
[devdependency-url]: https://david-dm.org/zce/locally-server?type=dev
[style-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
[style-url]: https://standardjs.com/