mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-23 10:32:36 +02:00
Added UI as submodule and as static in production, changed endpoint to /api/graphql
This commit is contained in:
parent
ea3ba51219
commit
bdecda99ba
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "apolloui"]
|
||||||
|
path = apolloui
|
||||||
|
url = https://github.com/CryptofyCH/apolloui
|
1
apolloui
Submodule
1
apolloui
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 95ae5ac443284b49fd81d94a396de340d8d7280f
|
1
config/production.json
Normal file
1
config/production.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const sampleData = {
|
function getData() {
|
||||||
|
return {
|
||||||
"summary": [
|
"summary": [
|
||||||
{
|
{
|
||||||
"STATUS": [
|
"STATUS": [
|
||||||
@ -15,7 +16,7 @@ const sampleData = {
|
|||||||
"SUMMARY": [
|
"SUMMARY": [
|
||||||
{
|
{
|
||||||
"Elapsed": 847,
|
"Elapsed": 847,
|
||||||
"MHS av": 3.364,
|
"MHS av": getRandomFloat(3.00, 4.00),
|
||||||
"MHS 20s": 3.324,
|
"MHS 20s": 3.324,
|
||||||
"Found Blocks": 0,
|
"Found Blocks": 0,
|
||||||
"Getworks": 30,
|
"Getworks": 30,
|
||||||
@ -169,12 +170,21 @@ const sampleData = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id": 1
|
"id": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const PORT = 4028;
|
const PORT = 4028;
|
||||||
const HOST = 'localhost';
|
const HOST = 'localhost';
|
||||||
|
|
||||||
|
function getRandomArbitrary(min, max) {
|
||||||
|
return Math.random() * (max - min) + min;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRandomFloat(min, max) {
|
||||||
|
return parseFloat(Math.random() * (max - min) + min);
|
||||||
|
}
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
constructor(port, address) {
|
constructor(port, address) {
|
||||||
this.port = port || PORT;
|
this.port = port || PORT;
|
||||||
@ -193,7 +203,7 @@ class Server {
|
|||||||
|
|
||||||
sock.on('data', (data) => {
|
sock.on('data', (data) => {
|
||||||
console.log(`${clientName} Says: ${data}`);
|
console.log(`${clientName} Says: ${data}`);
|
||||||
sock.write(JSON.stringify(sampleData));
|
sock.write(JSON.stringify(getData()));
|
||||||
// sock.write('exit');
|
// sock.write('exit');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
const path = require('path')
|
||||||
const express = require('express')
|
const express = require('express')
|
||||||
const config = require('config')
|
const config = require('config')
|
||||||
const graphqlApp = require('./graphqlApp')
|
const graphqlApp = require('./graphqlApp')
|
||||||
|
const buildPath = path.join(__dirname, '../../apolloui/build');
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
app.use('/graphql', graphqlApp)
|
app.use('/api/graphql', graphqlApp)
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') app.use(express.static(buildPath));
|
||||||
|
|
||||||
module.exports = app
|
module.exports = app
|
||||||
|
Loading…
Reference in New Issue
Block a user