npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fanbook-mock

v1.0.0

Published

使用json-server应用到fanbook小程序,实现fanbook本地开发完美mock接口数据和sdk方法数据

Downloads

1

Readme

进击的fanbook小程序项目 - mock方案的实现

前言

这个方案也适用于其他fanbook小程序

目前小程序的调试方法:

  1. 登录到配置管理后台
    用户名 admin
    密码 123456789
  2. 启动项目后 > 在配置管理中 > 找到对应的项目 > 找到 fanbook重定向url > 修改ip和端口为自己本机的ip和启动端口
  3. 在fanbook的APP中找到对应服务器进行调试,授权后会重定向本地url,将token写入localStorage

分析

调用接口api应用层面

能在本地开发环境上进行调试,但都是在上面配置项修改好的情况下

单人模式下,这样调试准确,能和后台进行交互

多人模式下,需要频繁的去修改配置项,可能会引起开发人员的冲突,降低开发效率,影响开发心情

所以需要一个mock方案,来指定一些虚拟数据,以适应多人开发,提高开发效率

不过这个方案不能和后端进行交互,都是假数据,需要真实数据的调试还是请用标准调试方法

本脚手架已采用json-server方案。选型规则请查看最下方导览

fb sdk应用层面

目前使用的fb sdk,只有fb.init()和fb.oAuth()做了web适配,可以在本地浏览器调试,其他fb方法直接抛出错误

这在使用fb sdk方法的代码调试过程中,极为不便

所以需要对调用fb的方法进行模拟数据返回,这样就能在本地浏览器进行开发预览,提高开发效率

导览

  1. mock方案选型 见[1-Mock 方案对比]
  2. json-server使用方法,见[2-本地体验json-server]
  3. 应用mock方案到项目,见[3-应用mock方案到项目]
  4. 已适配好的项目