Giter Club home page Giter Club logo

ow-ban-list-backend's Introduction

ow-ban-list-backend

Get the ban list from Overwatch BBS (China). Currently deployed at ow-ban-list-v1.0x00000000.tk.

Requirements

  • Node.js runtime environment (8.x or above)
  • npm or other functionally equivalent package manager (used to install dependencies and build)
  • PostgreSQL (used to store the ban list)
  • A Netlify account

APIs

Development and Deploy

Clone

To continue develop and/or deploy this project, first you need to clone this repository to you local workspace.

git clone https://github.com/Luluno01/ow-ban-list-backend.git --depth=1 --recursive

Then you will need to install dependencies using npm inside the cloned repository directory.

npm install

Deploy a PostgreSQL Database

There are many ways to deploy a PostgreSQL database. You can

  • install a PostgreSQL database instance on your cloud server or your local PC, or
  • deploy a PostgreSQL container on the cloud, or
  • deploy a PostgreSQL database instance on ElephantSQL, which provides 20 MB data capacity and 5 concurrent connections for free (personally recommended for development usage)

After deploy your PostgreSQL database, you shall have a database connection URL, which looks like

postgres://username:[email protected]:5432/database_name

If your database service provider doesn't provide you a connection URL, you can simply construct one.

Then you need to set a environment variable DB_URL to the connection URL in your workspace.

set DB_URL=<your connection URL>

Build

For quicker build and debug, you can set the environment variable DEBUG to an arbitrary value in your workspace to enable development mode.

set DEBUG=true

If it is the first time you build the cloned repository, you should run

npm run build

Otherwise

npm run buildFunction

Synchronize Database

Note that you need a DB_URL environment set to a PostgreSQL connection URL for this step.

By executing the following command, you will fetch all the ban announcements from Overwatch BBS (China) into your database (old tables will be dropped and re-created).

npm run sync

If no changes are made to the database schemas, you will not need to execute this command a second time. However, everytime you move to a new database instance or change the database schema, you should synchronize the database again.

Running Locally

Note:

  1. This step is not require if you only want to deploy this repository.
  2. You need a DB_URL environment set to a PostgreSQL connection URL for this step.

Simply run

npm run serve

Then you can access the APIs via http://localhost:9000/. Of course you need to build and synchronize database at least once before running the server locally.

Deploy to Netlify

To deploy this repository, click the button below.

Deploy to Netlify

IMPORTANT NOTE: Please remember to set the DB_URL environment variable in the site settings pannel.

Or you can deploy your own repository, see Netlify documentation for more details.

ow-ban-list-backend's People

Contributors

luluno01 avatar

Watchers

James Cloos 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.