/vue-typescript-admin-mock-server

🖥 Mock server for vue-typecript-admin-template project

Primary LanguageJavaScriptMIT LicenseMIT

vue-typescript-admin-mock-server

PRs Welcome License: MIT Template from jarvis

Mock server for vue-typecript-admin-template project

Demo link

Demo (used by vue-typecript-admin-template)

Overview

The javascript code under api folder in this project was generated from the typescript source code located at here (by running tsc command in this directory). The only manually change is to rename the mock-server.js to index.js.

Swagger

The url schema is based on Swagger config file and follows REST api standard.

info: {
  name: 'Mock API',
  description: 'Mock API for vue-typescript-admin-template.',
  version: '1.0.0'
},
paths: {
  get: [
    '/mock-api/v1/articles',
    '/mock-api/v1/articles/:id',
    '/mock-api/v1/pageviews',
    '/mock-api/v1/transactions',
    '/mock-api/v1/roles',
    '/mock-api/v1/routes',
    '/mock-api/v1/users',
    '/mock-api/v1/users/:username'
  ],
  post: [
    '/mock-api/v1/articles',
    '/mock-api/v1/roles',
    '/mock-api/v1/users/register',
    '/mock-api/v1/users/login',
    '/mock-api/v1/users/logout',
    '/mock-api/v1/users/info'
  ],
  put: [
    '/mock-api/v1/articles/:id',
    '/mock-api/v1/roles/:id',
    '/mock-api/v1/users/:username'
  ],
  delete: [
    '/mock-api/v1/articles/:id',
    '/mock-api/v1/roles/:id',
    '/mock-api/v1/users/:username'
  ]
}

Try it on your own computer

First install all dependencies:

yarn # OR npm install

Then you can set up the server:

yarn mock # OR npm run mock

or use the vercel dev command.

Host

This mock server is hosted by Vercel.

Contributing

See CONTRIBUTING.md

License

MIT License