Git Product home page Git Product logo

anonymous-vote's Introduction

Anonymous-vote

基于Node.js的匿名实时投票系统。

需要自行分配登录token

Install

需要安装Node.jsnpm

$ git clone https://github.com/ArronYR/Anonymous-vote

$ cd myapp
$ npm install

在根目录下添加config.json,内容格式如下:

{
    "db": {
        "host": "127.0.0.1",
        "user": "user",
        "password": "password",
        "port": 3306,
        "database": "node_vote"
    },
    "token": "ae0fdb6f2512df5fcf712da4ed7b5daf"
}

token是用来控制访问【开始投票】页面以及页面中部分请求的参数。

启动

MacOSLinux 系统, 运行以下命令启动程序:

$ DEBUG=vote:* npm start

Windows 上执行以下命令启动:

set DEBUG=vote:* & npm start

更多的命令参数参考 express-generator

部署

采用 pm2 能够很方便的完成部署。

$ npm install pm2 -g

第一次启动的时候,在项目根目录下执行:

$ pm2 start bin\www --name vote 

之后如果要关闭执行:

$ pm2 stop vote

此后启动都只需执行:

$ pm2 start vote

如果要使用 Nginx 配置域名,只需在 Nginx 的配置文件目录中添加一个文件,内容如下:

server{
    listen          80;
    server_name     vote.domain.com;
    location / {
        proxy_redirect          off;
        proxy_set_header        Host    $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass              http://127.0.0.1:1607;
    }

    location ~ /socket.io {
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_pass              http://127.0.0.1:1607;
        proxy_http_version      1.1;
        proxy_set_header        Upgrade $http_upgrade;
        proxy_set_header        Connection "upgrade";
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout      150;
        access_log              off;
    }
}

anonymous-vote's People

Contributors

arronyr avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.