Giter Site home page Giter Site logo

huhuhang / jsonbase Goto Github PK

View Code? Open in Web Editor NEW
28.0 1.0 4.0 7 KB

本项目提供了基于 Cloudflare Workers 部署的 JSON Database 数据库。可以方便地存储和读取 JSON 数据。

License: MIT License

JavaScript 100.00%
cloudflare-workers json jsonbase database

jsonbase's Introduction

jsonbase

English README

本项目提供了基于 Cloudflare Workers 部署的 JSON Database 数据库。可以方便地存储和读取 JSON 数据。

示例

使用 POST 向命名空间 demo_bucket/hello 写入示例数据 {"hello": "world"}

curl -X "POST" "https://jsonbase.huhuhang.workers.dev/demo_bucket/hello" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{"hello": "world"}'

使用 GET 方法获取命名空间 demo_bucket/hello 的数据:

curl "https://jsonbase.huhuhang.workers.dev/demo_bucket/hello"

返回:

{"hello":"world"}

如何部署

你可以直接在 Cloudflare Workers 网页版中新建项目,并复制本仓库中的 index.js 到在线编辑器中部署。

同时需要创建一个 KV 数据库,并绑定到 Cloudflare Workers。

1640759478099

或者使用官方提供的 wrangler cli 工具:

  1. 了解 Cloudflare Workers 命令行工具 wrangler 的使用方法。

  2. 基于本项目初始化一个新的项目。

    wrangler generate jsonbase https://github.com/huhuhang/jsonbase
  3. 请修改 wrangler.toml 中预留的 account_id,替换为你的账户信息。

  4. 请修改 wrangler.toml 中预留的 KV 数据库 id,替换为你的账户信息。

  5. jsonbase 项目添加到 Cloudflare Workers 部署。

身份认证

目前没有添加任何身份认证,为了保护数据安全,可以使用 Cloudflare Access 创建请求策略。或者参考 官方示例 修改代码添加认证模块。请不要在生产环境使用项目中的示例数据库,你的数据可能被移除或篡改,请自行部署。

jsonbase's People

Contributors

huhuhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.