Get the ban list from Overwatch BBS (China). Currently deployed at ow-ban-list-v1.0x00000000.tk.
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
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
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>
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
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.
Note:
- This step is not require if you only want to deploy this repository.
- 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.
To deploy this repository, click the button below.
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.