当前位置:网站首页>Finally, when you open source the applet ~

Finally, when you open source the applet ~

2022-06-25 07:10:00 Wukong chat architecture

reply PDF Collect information  

This is Wukong's first 93  Original articles

author | Wukong chat structure

source |  Wukong chat structure (ID:PassJava666)

Please contact authorization for reprint ( WeChat ID:PassJava)

The main contents of this paper are as follows :

One 、 origin

PassJava Open source project is a Interview questions Open source system , Back end adoption Spring Cloud Microservices can be used in spare time Applet View common interview questions , Tamp Java Technology stack , Of course, the question bank is not limited to Java, And microservices .

A reader asked me before Is the applet open source , Because I was writing a series of articles on distributed algorithms , So the open source project was interrupted for a while , Now continue to update the open source project .

In order to let readers learn this project better , I have opened the applet code .

The code address of the applet is github above , Don't forget to order star, The quality of three consecutive ha ~

https://github.com/Jackson0714/PassJava-Platform/tree/master/passjava-miniApp

The applet experience code is as follows :

Applet interface :

There are two versions of the applet : Cloud development and advanced . Here are the introduction .

Two 、 Cloud development

2.1 Applet · Introduction to cloud development

Applet · Cloud development is a professional small program development service launched by wechat team and Tencent cloud .

Developers can use cloud development to quickly develop small programs 、 Little games 、 The official account page, etc , And the original ability to open wechat .

Developers don't have to build servers , You can directly use the API Business development .

2.1.1 advantage :

  • There's no need to set up a server , Just use the capabilities provided by the platform , You can quickly develop your business .
  • No need to manage certificates 、 Signature 、 Secret key , Call wechat directly API . Reuse wechat private protocol and link , Ensure business security .
  • Support environment sharing , A back-end environment can develop multiple small programs 、 official account 、 Web page, etc , Convenient reuse of business code and data .
  • Developers can use any language and framework for code development , After being built as a container , Quickly host it to cloud development .
  • Support billing by volume mode , Back end resources are automatically expanded according to business traffic , Use first, pay later , No need to pay idle costs .

2.1.2 characteristic

Cloud database : Document database , Stable and reliable ; It supports calling in small program ends and cloud functions .

Storage : Cloud file storage , Bring their own CDN Speed up , Support direct upload on the front end / download , It can be visually managed in the cloud development console .

Cloud functions : Code running in the cloud , Wechat private agreement natural Authentication , Developers just need to write their own business logic code .

Cloud hosting : Support for managed service containers , No limit to frames and languages , Resident operation 、 Natural Authentication , Fast business migration

2.1.3 shortcoming

  • Suitable for personal development .
  • Pay by traffic , If there are too many visitors , Need to buy traffic .
  • Because the server comes with Tencent , So you can't use other back-end middleware to realize function enhancement , such as Redis,RabbitMQ.
  • The database and storage are also provided by Tencent , So you can't use other databases and storage , such as mysql、 Alibaba cloud .

2.2 Download and use the applet

2.2.1 Introduction to question bank

The function of question bank is shown in the following figure :

  • First step : Go to select topic type . Here you are 12 Species category , Click one of them to jump to the topic list page .
Topic type
  • The second step : Go to the question bank list page . The picture below is Spring Question bank list page , You can click view to enter the details page of the topic .
Spring Question bank
  • The third step : Go to the title details page . As shown in the figure below is spring The details page of the interview questions , The loaded content is uploaded to cloud storage markdown file . How to upload topics will be explained later .
Title details page

2.2.2 Upload title

If you want to use this cloud development version of the applet , You need to upload the title file to cloud storage first .

As shown in the figure below , I uploaded a lot markdown file , You can write it yourself markdown file , Each document corresponds to a topic , The content inside is the problem of the title + answer .

2.2.3 Add a title record

Then you need to insert data into the database , To provide the applet with a query .

I exported a record , You can insert it directly into the database .

{
 "_id""27a98c6c-0477-4edb-8ef3-e35f0501b31c",
 "question""1.JAVA Exception classification and handling ?",
 "answer""cloud://test-0jlva.7465-test-0jlva-1254012214/markdown/02_JavaBasic/ One 、JAVA  Exception classification and handling .md",
 "number""1",
 "subTitle"" Make a little progress every day ",
 "type""javaBasic",
 "level""1"
}
  • question: The question of the title .
  • answer: Answer to the question .
  • number: The serial number of the title .
  • subTitle: Subtitle of the title .
  • type: The type of topic , There are javaBasicjvmspring etc. 12 Kind of . You can also add .
common 12 Kind of

markdown The title of the format has been uploaded to github, At present, there are only some , Welcome to commit.

https://github.com/Jackson0714/passJavaKnowledge/tree/master

Besides, I have 1000 Of the pavement test questions pdf It can also be used as a question bank , Students who need to reply back on the official account The wu is empty Get it .

2.3 Principle of small program

The schematic diagram of the small program is as follows :

Schematic illustration :

1) call Write your own cloud functions getJavaQuestionList To obtain a list of ;

2) call Write your own cloud functions getJavaQuestionDetail For details Markdown File path ;

3) call The cloud function provided by the system downloadFile download Markdown Save the file as a temporary file ;

4) call Applet's own saveFileSync Save temporary files locally ;

5) call Applet's own readFileSync Read local files into the cache ( Be careful : The developer tool can be read normally without saving to the local );

6) Use towxml Open source components will be cached markdown The content is transformed into elements that the applet can recognize

7) to Add preview events to picture elements

Because the small program is mainly used to brush questions , Additional functions such as banner advertising 、 I will not introduce the hot recommendations here .

For some students , Cloud development is relatively new , You need to read more official documents to be familiar with the secondary development .

3、 ... and 、 premium

The advanced version of the applet of the project refers to the development without cloud , Back end adoption Spring Cloud Microservices as service support , The database is not a cloud database , It is mysql.Rest Although the version is not perfect at present , But it has been connected with the back-end .

3.1 Conditions of use

At present, the following conditions are required to connect the front end and the back end together :

  • The local background microservice was started successfully .

    At present, it is required that passjava-gateway、passjava-question、renren Successful launch .

  • MySQL Database and table structure created successfully .

    The database file is in \data\sql Catalog , It needs to be carried out . After successful execution , The business table has a total of 5 Business modules , 7 A watch , As shown in the figure below :

  • Nacos The service is started successfully and the related configurations of the microservice have been configured .

    Refer to the previous article on how to configure . Access address :http://192.168.56.1:8848/nacos. visit Nacos, And log in Nacos after , As shown in the figure below :

  • passjava-portal The management console started successfully .

    adopt http://localhost:8001/ visit .

  • The topic management function is used normally .

    You can create topic types and create topics .

  • Opening the applet code is normal .

    In addition, we need to pay attention to ,Rest The title type and title list of the current homepage of the version are under development , So I still use the cloud function , Get the id yes 1. At this stage, it is only for learning , My time is limited , Welcome to help commit.

Four 、 Open source address

I put the back end 、 front end 、 Small programs are uploaded to the same warehouse , You can go through GitHub or Code cloud visit . The address is as follows :

Github: https://github.com/Jackson0714/PassJava-Platform

Code cloud :https://gitee.com/jayh2018/PassJava-Platform

Tutorial :www.passjava.cn

Debugging code is hard work , Energy co., LTD. , When writing technical articles , You also need to find time to juggle this open source project , So is it worth praising ?

Reference material :

https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html

www.passjava.cn

- END -

I wrote two PDF, reply   Distributed   or  PDF  Next load .
my JVM The column is on the shelves , reply  JVM  receive

I'm Wukong , Try to be strong , Become a super Saiya !

This article is from WeChat official account. - Wukong chat structure (PassJava666).
If there is any infringement , Please contact the [email protected] Delete .
Participation of this paper “OSC Source creation plan ”, You are welcome to join us , share .

原网站

版权声明
本文为[Wukong chat architecture]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250508484937.html