Compiling the deployment Rap2 on Windows

Source: Internet
Author: User

      • Compiling the deployment Rap2 on Windows
        • Introduction
        • Install the required environment
        • Installing the back-end site
          • Create a database
          • PM2 and typescript are installed globally
          • Configuring Mysql,redis Database Link Configuration
          • Initialization
          • Compile
          • Initializing a database table, populating the underlying data
          • Perform mocha test case and JS code specification check
          • Start the service
        • Installing the front-end site
          • Initialization
          • Configure the service end address used by the front-end site
          • Packaging program
          • Deploy site
            • Using IIS
            • Using the server command
        • Conclusion
Introduction

The RAP2 uses a pre-and post-separation architecture.
Backend Source Address: Rap2-delos based on KOA + MySQL
Front-end Source address: Rap2-dolores based on react

First download the source code, through the Git or the direct root directory download decompression can, self-solve the problem of slow download speed.

Install the required environment

node. JS 8.9.4+ installs the latest Windows edition
MySQL 5.7+ do not use the latest version, there will be problems, stepping on the pit
Redis 4.0+ This measured 3.2 is no problem, window version
Provides a Redis service with a default port without a password.

Install back-end site CREATE Database Mysql-e 'CREATE DATABASE IF not EXISTSRap2_delos_appDEFAULT CHARSETUtf8COLLATEUtf8_general_ci'PM2 and TYPESCRIPTNPM are installed globallyInstall-G PM2NPMInstall-G typescript Configuration Mysql,redis Database link configuration

In the/src/config/config.xxx.js can find the corresponding configuration, according to the actual situation filled.

Initialization

Perform

NpmInstall

Some packages may appear, depending on the package name, can be installed using NPM install XXXX.

Compile NPM Run Build initialize database table, populate base data npm run CREATE-DB execute Mocha test case and JS code specification check NPM run Check startup service

Check that the next 8080 ports are occupied before starting the service, or you can modify the port in/src/config/config.xxx.js

NPM start

(IIS has iisnode to allow IIS to host the node program, but it has not been successfully configured, so it is still used PM2 to host running this program)

Installing the front-end site

This is a purely static site, which needs to be packaged first and then hung on the IIS line.

Initialization

The root directory of the download source package is executed

NPM install configures the service end-end address used by the front-end site

You can find it in the/src/config/config.prod.js (production mode profile)

Packaging program

The root directory of the download source package is executed

NPM Run Build

If executed successfully, a build folder will be generated in the root directory, which is the published site file.

Deploying a site using IIS

Create a new site using the build folder. Need, this time can already see the effect, but when the user refreshes the page in the non-root directory, there will be 404 pages.
Special handling is required here:
Method 1: Configure on IIS, select the error page under Site-Features view-"Edit 404 status Code-" To execute \index.html on this site.
Method 2: Use the Urlrewrite feature to rewrite all requests to \index.html.

Using the server command

Installing the server command NPM install-g server
Run: serve-s./build-p 80
This is the official plan.

Conclusion

The installation process is not smooth sailing, mostly in the implementation of the NPM command, basically missing packages or commands, and then use NPM install XXXX installation is good.

Compiling the deployment Rap2 on Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.