Socket
Socket
Sign inDemoInstall

avoscloud-code-mock-sdk

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avoscloud-code-mock-sdk

AVOSCloud Cloud Code Mock SDK.!


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

说明

为了方便本地运行和调试云代码,请遵照下列步骤进行:

  • 下载本目录下的三个文件(package.json,cloud_code.js,mock.js),放到你的云代码项目的根目录,跟cloud目录平级。
  • 将下面内容添加到项目的.gitignore文件:
node_modules/
package.json
cloud_code.js
mock.js
local_storage.json
  • 要在本地调试云代码,你需要安装node.js最新版本。
  • 在项目根目录运行npm install -d安装依赖。
  • 在项目根目录运行命令 node mock.js启动调试服务器。
  • 访问http://localhost:3000/即可访问到你的云主机代码,子路径按照你在app.js里配置的即可访问。
  • 测试函数:
curl -X POST -H 'Content-Type:application/json' \
    -d '{ "name": "dennis"}' \
    http://localhost:3000/avos/hello

其中hello是你通过AV.Cloud.define定义的函数名称。

  • 测试beforeSave,afterSave,afterUpdate,beforeDelete/afterDelete等:
curl -X POST -H 'Content-Type:application/json' \
     -d '{ "name": "dennis"}' \
	 http://localhost:3000/avos/MyUser/beforeSave

其中MyUser是className,beforeSave指定调用MyUser定义的beforeSave函数,其他函数类似。

FAQs

Package last updated on 10 Oct 2013

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