New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@winm2m/cfworker-base

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@winm2m/cfworker-base

A library for creating basic CRUD endpoints for Cloudflare Workers.

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

@winm2m/cf-worker-base

Description

A library for creating basic CRUD endpoints for Cloudflare Workers. It use a notion page as database.

Usage

0. Preparation

  • Create an API Token of Notion
  • Create a new Database in Notion
  • Create a new Service in Cloudflare Workers
  • Create a new KV Namespace
  • Below keys are required in KV Namespace
    • jwt_secret : JWT secret key
    • notion_token : Notion API token
    • notion_db_title : Title of Notion Database
  • Install wrangler

1. Init wrangler project and install @winm2m/cf-worker-base

$ wrangler init
$ npm install --save @winm2m/cf-worker-base

2. Add kv namespace to wrangler.toml

kv-namespaces = [
  { binding = "KV", id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
]

3. Update index.js

import { requestHandler } from '@winm2m/cfworker-base'

const handler = new requestHandler(`/api`)

export default {
  fetch: (request, env, ctx) => handler.handleRequest(request, env, ctx)
}

Appendix - command to test largedata

$ npx -p @babel/core -p @babel/node babel-node --presets @babel/preset-env test/test_largedata.js create-largedata create-largedata

Keywords

winm2m

FAQs

Package last updated on 22 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts