Giter VIP home page Giter VIP logo

scribe's Introduction

Scribe

A GraphQL Magic: The Gathering API Server

Table of Contents

Getting Started

Back to Top

Installation

Before you start, make sure you have a working NodeJS environment, with NPM 3. Preferably use Yarn instead of NPM for installation of packages to ensure that you'll use exactly the same dependencies as the project.

From the project folder, execute the following command:

npm install

Or if you are using Yarn, execute this command instead:

yarn

Once installation of project dependencies completes, run the following command to set up your local development environment:

npm run setup

First this will create a default .env file in which you can define various environment variables such as your MySQL connection details, should you like to use it instead of SQLite3. .env is used to store sensitive information you do not want to commit.

Second, it will create a new database file under src/scribe.sqlite to serve as your default local development database. It will then run a set of Knex.js migrations to set up the default database schema.

Your development environment is now ready to go!

Back to Top

Running the Server Locally

To start the server, simply run the following command:

npm start

The server should now be listening on port 1337. To access GraphiQL and begin exploring the API documentation, navigate to http://127.0.0.1:1337/graphiql in your browser of choice.

Next, you can begin to populate your newly created database by running the following in a second terminal window:

npm run populate

This will populate the database with data from the Magic: The Gathering API and download all card images to src/images.

Please note: populate may take many hours to fully run! You can cancel the script at any time during execution. It is recommended that you at least allow it to run until some cards from the first set are added to the database in order to have a decent amount of seed data to play with. Execution may run faster using MySQL instead of SQlite3. Please refer to Running the Server in Production for more information.

Back to Top

Running the Server in Production

If you would like to run the server in "production" mode, you will first need to install and setup MySQL on your local machine. Once complete, set your connection details in .env. Scribe uses this file to configure the database connection, otherwise it will use defaults defined in src/config/server.config.js.

To reset your production database schema, run:

npm run resetdb:prod

Warning: this will first attempt to drop any database named 'scribe'.

When completed, you can then run the server in production using:

npm run start:prod

To switch back to development, simply run:

npm run start:dev

Back to Top

Resetting the Database

To delete all the data in the database and start from scratch, run one of the following commands:

Development (Sqlite3):

npm run resetdb

Production (MySQL):

npm run resetdb:prod

This is useful when making changes to the database schema, the populate script, or simply when you need to clear out existing data.

Back to Top

License Information

This application uses images and data that are copyright of Wizards of the Coast (http://magic.wizards.com/en)

Scribe is made available under the MIT License (https://opensource.org/licenses/mit-license.html)

Attribution is greatly appreciated! Please feel free to fork the project and submit pull requests.

Back to Top

Prior Art

Scribe would not be possible without the fantastic work of Andrew Backes @adback03 on his Magic: The Gathering API project.

Back to Top

scribe's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scribe's Issues

Question: Set icons

I have been reading through your code, and I can't figure out how you are getting the icon for each set. From what I can see, the MTG API does not expose icon URLs for card sets. Are you loading them from another source? Thanks in advance.

Action required: Greenkeeper could not be activated šŸšØ

šŸšØ You need to enable Continuous Integration on all branches of this repository. šŸšØ

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didnā€™t receive a CI status on the greenkeeper/initial branch, itā€™s possible that you donā€™t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how itā€™s configured. Make sure it is set to run on all new branches. If you donā€™t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, youā€™ll need to re-trigger Greenkeeperā€™s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integrationā€™s white list on Github. You'll find this list on your repo or organizationā€™s settings page, under Installed GitHub Apps.

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.