mirror of
https://github.com/Retropex/apolloapi-v2.git
synced 2025-05-21 17:42:33 +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';
|
||||
|
||||
const sampleData = {
|
||||
function getData() {
|
||||
return {
|
||||
"summary": [
|
||||
{
|
||||
"STATUS": [
|
||||
@ -15,7 +16,7 @@ const sampleData = {
|
||||
"SUMMARY": [
|
||||
{
|
||||
"Elapsed": 847,
|
||||
"MHS av": 3.364,
|
||||
"MHS av": getRandomFloat(3.00, 4.00),
|
||||
"MHS 20s": 3.324,
|
||||
"Found Blocks": 0,
|
||||
"Getworks": 30,
|
||||
@ -169,12 +170,21 @@ const sampleData = {
|
||||
}
|
||||
],
|
||||
"id": 1
|
||||
}
|
||||
}
|
||||
|
||||
const net = require('net');
|
||||
const PORT = 4028;
|
||||
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 {
|
||||
constructor(port, address) {
|
||||
this.port = port || PORT;
|
||||
@ -193,7 +203,7 @@ class Server {
|
||||
|
||||
sock.on('data', (data) => {
|
||||
console.log(`${clientName} Says: ${data}`);
|
||||
sock.write(JSON.stringify(sampleData));
|
||||
sock.write(JSON.stringify(getData()));
|
||||
// sock.write('exit');
|
||||
});
|
||||
|
||||
|
@ -1,9 +1,13 @@
|
||||
const path = require('path')
|
||||
const express = require('express')
|
||||
const config = require('config')
|
||||
const graphqlApp = require('./graphqlApp')
|
||||
const buildPath = path.join(__dirname, '../../apolloui/build');
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user