Front end micro service solution 4 – new module construction


After deploying the code, we need to create a new module to implement the code

Creation method


  • When creating a new module, we need to create it according to the production situation. Do not cause module redundancy and clutter.
  • The generation of modules needs to be strictly in accordance with the instructions, and they can’t be made up by themselves, or they can’t be empty, otherwise the project construction will not find the path and pollute the old modules.

Execute instructions

#Create module code instruction
npm run new

Then, the following code will appear in the window, indicating that the initialization operation is in progress

>Vue module Pro @ 1.0.9 new ${project path}
> plop

After execution, enter the resource name according to the following instructions

?  Please enter project name:
?  Do you need to generate project public header( y/N)
?  Do you want to use the vantui component( y/N)
?  Please enter the back end address:
?  Please enter the front-end running port (for example: 8080):

After executing the above commands in sequence, a new module can be generated automatically, showing the following successful interface.
Front end micro service solution 4 - new module construction

The new micro module contains basic pages and necessary components, which can directly support startup and packaging.

How to divide modules

To clarify this problem, we must first understand the implementation mechanism of the project

The project is realized by modulesFront end micro serviceIn other words, the project does not force students to define the module. Example:

  • A page can be regarded as a module;

  • It can be divided into modules according to business, one business is in charge of one module;

  • Can be divided according to the product, a module represents a product;

According to the actual production, N modules can be created in the project, and the module can call one or more back ends.

srcEach folder below (exceptcomm)It represents the module name of each module, corresponding to a page / business / product.
Front end micro service solution 4 - new module construction

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Implementation example of go operation etcd

etcdIt is an open-source, distributed key value pair data storage system, which provides shared configuration, service registration and discovery. This paper mainly introduces the installation and use of etcd. Etcdetcd introduction etcdIt is an open source and highly available distributed key value storage system developed with go language, which can be used to configure sharing […]