New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kway/core

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kway/core

@kway/core是基于Koa、GraphQL搭建的服务程序

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@kway/core 使用说明

介绍

@kway/core是基于Koa、GraphQL搭建的服务程序

安装

目前属于实验阶段,npm i @kway/core

使用

import server from '@kway/core`

server.listen({
  models, // 数据处理模型程序
  auth, // 服务器请求验证方法
  handlers // 自定义Koa解决器
})

参数说明

models // 数据处理模型程序

如定义Test为数据处理模型则

import Test from './models/test`
{
  models: {test: Test}
}

请求验证方法 返回Boolean true-请求通过 false-请求被拒绝

{
  auth(request /*请求对象,等同于Koa的ctx.request对象*/){
    // 验证提交数据内容,如token或sessionid
    return true
  }
}

自定义Koa解决器

handlers: [
  async function (ctx, next) {
    if (ctx.path.indexOf('/test') > -1) {
      ctx.body = await 'foo'
    } else {
      await next()
    }
  }
]

FAQs

Package last updated on 20 Jun 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc