Cryrivers / manta-style

🚀 The futuristic API Mock Server for Frontend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@manta-style node API

tanhauhau opened this issue · comments

Decouple API and the CLI.
Suggesting API

class MantaStyle {
   constructor(configPath: string){}
   // run manta style server
   run(callback) {}
   // run manta style server + watch config hot reload
   watch(callback) {}

   // snapshot api
   setSnapshot() {}
   getSnapshot() {}

   // proxy api
   setProxy() {}

   // mock api
   mockEndpoint() {}
   unmockEndpoint() {}
}

Yeah this is what I’m planning to do. This would be the prerequisite for extension system and multiple languages support.

The extension is more than mock data support. But it also extends the functionality of the CLI. I had a discussion with my teammates and we would really like to see it to be a tool to generate boilerplate code based on URL and type definition. Imagine you design a full-stack system, starting with routes and schema, then you will have a manta style config file, then manta style could generate BE and FE boilerplate Code. For BE it could be express project with routers and controllers predefined. For FE it could be boilerplate code for calling APIs, and not to mention the existing mock server.

Language support I could think of includes Flow, GraphQL and JSON:API standard, installed as plugins.

Really excited to see this happen. Could we have a discussion when you are free? :)

Sure. maybe during lunch time?

Sorry I just saw it. 😂 I’m already at Galaxis

Closing as we already had such plugin architecture (sort of) to decouple API and CLI.