wafer2-nodejs local deployment server

Tips: Suppose you have deployed a small micro-channel Tencent cloud service program, and if not, do not look down, decisive election cloud development.

-------------------------------------------------------------------------------------------------------------------------------------------------

First config.js 

var host = "http://localhost:5757"

then

  qcloudAppId: '',
  qcloudSecretId: '',
  qcloudSecretKey: '',
  port: '5757',
  rootPathname: '',
  serverHost: '',
  tunnelServerUrl: '',
  tunnelSignatureKey: '',
  WxMessageToken: '',

Or go to the server / node_modules / wafer-node-sdk / index.js this file in the following piece of code need to comment, or will report ERR_INIT_SDK_LOST_CONFIG

/*

if ([rootPathname, useQcloudLogin, cos, serverHost, tunnelServerUrl, tunnelSignatureKey, qcloudAppId, qcloudSecretId, qcloudSecretKey, wxMessageToken].some(v => v === undefined)) throw new Error(ERRORS.ERR_INIT_SDK_LOST_CONFIG)

*/

Anyway, some several values ​​in our local no Tencent cloud server, or comment out, or assigned a value.

Fill in the appropriate values ​​on the mysql server at local mysql, probably as follows:

  mysql: {
    host: 'localhost',
    port: 3306,
    user: 'root',
    Db: 'fourth' ;
    pass: '123456',
    char: 'utf8mb4'
  },

CAuth mysql database needs to be exported from the Tencent cloud server, and then import local, or will be able to find some tables, also two tables, cAppinfo, cSessionInfo

In the node app.js starting the web server, client code is loaded in a small program,

Click Test logon interface

loginUrl:`${host}/weapp/login`,

If everything is okay, you should be able to return to the login user information

ctx.state.$wxInfo

{LoginState: 1,

userinfo:xxxxxxx

 

 

Reference Links: https://www.jianshu.com/p/ffa90a0e9770

Guess you like

Origin www.cnblogs.com/lfri/p/11978919.html