GithubHelp home page GithubHelp logo

ayixi / pay-app-final Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 14 KB

常用Web支付开发讲解(支付宝支付和微信支付, 基于 Nodejs), 教程地址: https://www.bilibili.com/video/BV1r541157Bo

JavaScript 69.71% HTML 29.57% Shell 0.72%

pay-app-final's Introduction

  • 一个基于 Nodejs 的微信支付实现库
  • 本库只实现了微信支付

Start

  • nodemon app.js [Linux]
  • nodemon.cmd .\app.js [Windows]

NPM

  • npm init -y
  • npm i express
  • npm i axios
  • npm i qs
  • npm i mongoose
  • npm i xml2js
  • npm i -g nodemon
  • npm i moment
  • npm i sha1
  • npm i ejs
  • npm i cookie-parser

Server

  • add user web

  • vim /etc/sudoers

    • web ALL=(ALL:ALL) ALL
  • ssh-copy-id -i ~/.ssh/aliyun.pub web@ip

  • ssh web@ip

  • sudo api-get update

  • sudo api-get install -y mongodb

  • sudo api-get install -y nginx

  • sudo api-get install -y git

  • sudo api-get install -y nodejs

  • sudo api-get install -y npm

  • Install latest version of nodejs

    • sudo npm i n -g
    • sudo n latest
  • sudo npm i nrm -g [switch image address]

    • nrm ls
    • nrm use taobao
  • sudo npm i pm2 -g [start nodejs-proj with process]

  • Git

    • New repository on Github
    • git remote add Github https://....git
    • git push -u Github master
  • SSH

  • Deploy

    • mkdir www

    • cd www

    • git clone ...

    • npm i

    • node app.js [Test]

    • pm2 start app.js --name pay-app

    • Nginx

      • cd /etc/nginx/config.d
      • sudo vim pay.conf
        upstream my_nodejs_upstream {
            server 127.0.0.1:3001;
            keepalive 64;
        }
      
        server {
            # listen 443 ssl;
            listen 80;
      
            server_name www.my-website.com;
            # ssl_certificate_key /etc/ssl/main.key;
            # ssl_certificate     /etc/ssl/main.crt;
      
            location / {
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $http_host;
      
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
      
                proxy_pass http://my_nodejs_upstream/;
                proxy_redirect off;
                proxy_read_timeout 240s;
            }
        }
      • cd /etc/nginx/sites-enabled
        • sudo vim default
        • listen 80 default_server -> listen 8080 default_server
        • listen [::]:80 default_server -> listen [::]:8080 default_server
      • sudo nginx -s reload
    • Apply for a HTTPS certificate

      • open 80 port on nginx
      • sudo nginx -s reload

AutoDeploy

  • chmod +x deploy.sh
  • ./deploy.sh

pay-app-final's People

Contributors

ayixi avatar

Watchers

 avatar  avatar

Forkers

luwanchao915

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.