mirror of
https://github.com/vkaelin/LeagueStats.git
synced 2026-03-25 12:57:28 +00:00
Change the Backend NodeJs API server
This commit is contained in:
parent
b552c5ccee
commit
acecc8a71c
3 changed files with 27 additions and 30 deletions
28
client/package-lock.json
generated
28
client/package-lock.json
generated
|
|
@ -5230,12 +5230,14 @@
|
|||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
|
@ -5250,17 +5252,20 @@
|
|||
"code-point-at": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
|
@ -5377,7 +5382,8 @@
|
|||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
|
|
@ -5389,6 +5395,7 @@
|
|||
"version": "1.0.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
}
|
||||
|
|
@ -5403,6 +5410,7 @@
|
|||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
|
|
@ -5410,12 +5418,14 @@
|
|||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"minipass": {
|
||||
"version": "2.3.5",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"safe-buffer": "^5.1.2",
|
||||
"yallist": "^3.0.0"
|
||||
|
|
@ -5434,6 +5444,7 @@
|
|||
"version": "0.5.1",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
|
|
@ -5514,7 +5525,8 @@
|
|||
"number-is-nan": {
|
||||
"version": "1.0.1",
|
||||
"bundled": true,
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
|
|
@ -5526,6 +5538,7 @@
|
|||
"version": "1.4.0",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
|
@ -5647,6 +5660,7 @@
|
|||
"version": "1.0.2",
|
||||
"bundled": true,
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ export default {
|
|||
this.loading = true
|
||||
this.axios({
|
||||
method: 'POST',
|
||||
url: process.env.NODE_ENV === 'development' ? 'http://localhost:5000/api' : 'https://leaguestats.valentinkaelin.ch/api',
|
||||
url: process.env.NODE_ENV === 'development' ? 'http://localhost:5000/api' : 'http://167.71.59.33/api',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require('dotenv').config()
|
||||
require('dotenv').config({path: __dirname + '/.env'})
|
||||
const express = require('express')
|
||||
const request = require('request');
|
||||
const bodyParser = require('body-parser');
|
||||
|
|
@ -7,7 +7,7 @@ const Promise = require("bluebird");
|
|||
const responseTime = require('response-time')
|
||||
const cors = require('cors');
|
||||
const app = express()
|
||||
import { Jax } from "./Jax";
|
||||
// import { Jax } from "./Jax";
|
||||
|
||||
/* Global Variables */
|
||||
const data = {
|
||||
|
|
@ -21,7 +21,7 @@ const data = {
|
|||
}
|
||||
|
||||
/* Setup Riot API Wrapper */
|
||||
const jax = new Jax()
|
||||
// const jax = new Jax()
|
||||
|
||||
/* Set Port */
|
||||
app.set('port', (process.env.PORT || 5000))
|
||||
|
|
@ -35,23 +35,6 @@ app.use(cors({
|
|||
]
|
||||
}));
|
||||
|
||||
/* Setup Production */
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
const path = require('path');
|
||||
const history = require('connect-history-api-fallback');
|
||||
const staticFileMiddleware = express.static(path.join(__dirname + '/dist'));
|
||||
app.use(staticFileMiddleware);
|
||||
app.use(history({
|
||||
disableDotRule: true,
|
||||
verbose: true
|
||||
}));
|
||||
app.use(staticFileMiddleware);
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
res.render(path.join(__dirname + '/dist/index.html'));
|
||||
});
|
||||
}
|
||||
|
||||
/* To retrieve data of post request */
|
||||
app.use(bodyParser.json()); // to support JSON-encoded bodies
|
||||
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
|
||||
|
|
@ -74,8 +57,8 @@ app.post('/api', function (req, res) {
|
|||
data.region = req.body.region;
|
||||
data.username = req.body.summoner;
|
||||
|
||||
jax.regionName = req.body.region
|
||||
newVersion()
|
||||
// jax.regionName = req.body.region
|
||||
// newVersion()
|
||||
|
||||
data.finalJSON = {};
|
||||
getAccountInfos(res);
|
||||
|
|
|
|||
Loading…
Reference in a new issue