Giter Site home page Giter Site logo

webpack_api_mocker's Introduction

webpack_api_mocker

A Vue.js project

webpack-api-mocker 的使用

  1. github 地址:https://github.com/jaywcjlove/webpack-api-mocker
  2. Webpack 最简单的方式 Mock API
  3. 在 webpack-dev-server 内添加 mock server

原项目地址:https://github.com/cag2050/webpack_api_mocker_demo 同时感谢这位作者

说明:自己直接 copy 了 cag2050 的项目做了修改,因为在自己使用过程中存在以下问题

  • npm run dev-mock 是报错 MOCK 不是内部命令 使用 cross-env 包 修改

    "dev-mock": "cross-env MOCK=true webpack-dev-server --inline --progress --config build/webpack.dev.conf.js"
  • 针对自己定义的接口和外部正常接口同时做了测试,确保在项目中已经存在的接口能够正常运行,自己定的 api (本地 mock 数据)也可以正常运营

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# serve with hot reload at localhost:8081
# use this url http://localhost:8081/github_stars_top test api
npm run dev-mock

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

webpack_api_mocker's People

Contributors

cag2050 avatar

Watchers

James Cloos avatar  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.