Skip to content

Commit 2b5609a

Browse files
committed
Restructure project
No frontend here, you silly!
1 parent 01a5aa5 commit 2b5609a

25 files changed

Lines changed: 53 additions & 5731 deletions

.gitignore

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,17 @@
33
##########
44
GameDataMultiLibrary.code-workspace
55

6+
##########
7+
# Setups #
8+
##########
9+
# Ignore environment setups for testing purposes
10+
*implementation/
611

7-
###############
8-
# Environment #
9-
###############
10-
*.env
11-
*.dev.env
12-
13-
14-
################
15-
# GitHub Pages #
16-
################
17-
18-
# Source from: https://github.com/github/gitignore/blob/main/GitHubPages.gitignore
19-
20-
# This .gitignore is appropriate for repositories deployed to GitHub Pages and using
21-
# a Gemfile as specified at https://github.com/github/pages-gem#conventional
22-
23-
# Basic Jekyll gitignores (synchronize to Jekyll.gitignore)
24-
_site/
25-
.sass-cache/
26-
.jekyll-cache/
27-
.jekyll-metadata
2812

29-
# Additional Ruby/bundler ignore for when you run: bundle install
30-
/vendor
13+
# Ignore Node installs
14+
node_modules/
3115

32-
# Specific ignore for GitHub Pages
33-
# GitHub Pages will always use its own deployed version of pages-gem
34-
# This means GitHub Pages will NOT use your Gemfile.lock and therefore it is
35-
# counterproductive to check this file into the repository.
36-
# Details at https://github.com/github/pages-gem/issues/768
37-
Gemfile.lock
38-
.vscode/tasks.json
16+
# Ignore secrets files
17+
*secrets*
18+
*.env
19+
*.dev.env

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "VGD Local Dev",
8+
"type": "shell",
9+
"command": "npx wrangler dev",
10+
"options": {
11+
"cwd": "${workspaceFolder}/site"
12+
}
13+
}
14+
]
15+
}

libraries/javascript/.gitignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

libraries/javascript/README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,39 @@
22

33
A JavaScript library for interacting with IGDB - a database of video game data. This implementation utilizes the Apicalypse module provided by IGDB to assist with request building.
44

5-
## Testing Setup
5+
## Usage
66

7-
You can test the library out-of-the-box with some simple setup.
7+
First you will need to acquire credentials from the Twitch API in order to call IGDB. Once you have a valid API token, you can call IGDB for data.
88

9-
1. Install the latest stable versions of Node and NPM.
10-
2. Clone/Download the project.
11-
3. From the root directory of the library, run `npm install`.
12-
4. Store client credentials (details below).
13-
5. From the project directory, run `node app.js`.
14-
6. Observe output data.
9+
1. Instantiate an instance of IGDB_Helper.
10+
2. Call `createRequest(CLIENT_ID, API_TOKEN)` with your appropriate credentials for accessing the API
11+
3. Chain any desired filters and options for that request.
12+
4. Call `.request(URL)` with your desired API endpoint.
13+
5. Handle the Promise as you see fit and observe the results.
1514

16-
## Client Credentials
15+
### Examples
1716

18-
You will need to create a file for storing your client credentials. Typically these secrets would be handled through your server environment, but for basic testing you can create this secrets file to immediately test the library.
17+
Get an API token from Twitch and prepare to build an IGDB request.
1918

20-
Reminder: DON'T COMMIT SECRETS TO VERSION CONTROL!
19+
```JavaScript
20+
// Get an OAuth Access token from Twitch
21+
const twitchApi = new TwitchApi();
22+
const apiToken = twitchApi.requestOauthToken(CLIENT_ID, CLIENT_SECRET); // Store these in your environment!
2123

22-
### Twitch Account for Authentication
24+
// Instantiate our helper and create a builder request
25+
const igdb = new IGDB_Helper();
26+
const igdbRequest = igdb.createRequest(CLIENT_ID, apiToken);
27+
```
2328

24-
IGDB is owned and operated by Twitch.tv. In order to authenticate with the api, you will need an active Twitch account and register a developer application with it to acquire a Client ID and Client Secret. See IGDB's documentation here for details: [IGDB Account Creation](https://api-docs.igdb.com/#account-creation)
29+
Get 5 genres and sort them by when they were last updated.
2530

26-
### Create Secrets File
31+
```JavaScript
32+
igdbRequest
33+
.fields("name", "updated_at")
34+
.limit(5);
2735

28-
1. Create a `secrets.json` file at the project root.
29-
2. Add two fields called `clientId` and `clientSecret`.
30-
3. Set those values to their respective values from your Twitch Developer App.
36+
const responseData = igdbRequest.request("/genres")
37+
.then(
38+
/* Handle promise here as desired */
39+
);
40+
```

libraries/javascript/app.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)