lets try this again loul

This commit is contained in:
Sendou
2019-05-05 23:17:32 +03:00
parent afaeaade2a
commit 00ce14149d
18 changed files with 35 additions and 17 deletions

2
.gitignore vendored
View File

@@ -6,6 +6,8 @@ node_modules
# testing
coverage
build
# misc
xrank_data
.DS_Store

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,13 @@
require('dotenv').config()
const { ApolloServer, UserInputError, AuthenticationError, gql } = require('apollo-server')
const { ApolloServer, UserInputError, AuthenticationError, gql } = require('apollo-server-express')
const mongoose = require('mongoose')
const express = require('express')
const cors = require('cors')
const Placement = require('./models/placement')
const Player = require('./models/player')
//const User = require('./models/user')
const jwt = require('jsonwebtoken')
const path = require('path')
mongoose.set('useFindAndModify', false)
mongoose.set('useCreateIndex', true)
@@ -273,7 +276,17 @@ const server = new ApolloServer({
}
})
const app = express()
app.use(cors())
server.applyMiddleware({ app })
app.use(express.static('public'))
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'public', 'index.html'));
})
const PORT = process.env.PORT || 3001
server.listen(PORT).then(({ url }) => {
console.log(`Server ready at ${url}`)
app.listen({ port: PORT }, () => {
console.log(`Server running on http://localhost:${PORT}${server.graphqlPath}`)
})

View File

@@ -11,6 +11,8 @@
"license": "ISC",
"dependencies": {
"apollo-server": "^2.4.8",
"apollo-server-express": "^2.4.8",
"cors": "^2.8.5",
"dotenv": "^7.0.0",
"graphql": "^14.2.1",
"jsonwebtoken": "^8.5.1",

View File

@@ -1,13 +1,13 @@
{
"files": {
"main.js": "/static/js/main.ac2727ea.chunk.js",
"main.js.map": "/static/js/main.ac2727ea.chunk.js.map",
"main.js": "/static/js/main.628479b6.chunk.js",
"main.js.map": "/static/js/main.628479b6.chunk.js.map",
"runtime~main.js": "/static/js/runtime~main.a8a9905a.js",
"runtime~main.js.map": "/static/js/runtime~main.a8a9905a.js.map",
"static/js/2.a93ba1fd.chunk.js": "/static/js/2.a93ba1fd.chunk.js",
"static/js/2.a93ba1fd.chunk.js.map": "/static/js/2.a93ba1fd.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.9c2970ab19939ec2b3ea214716e54fe9.js": "/precache-manifest.9c2970ab19939ec2b3ea214716e54fe9.js",
"precache-manifest.147193d7011663af7c5ac1c1c31f14fa.js": "/precache-manifest.147193d7011663af7c5ac1c1c31f14fa.js",
"service-worker.js": "/service-worker.js"
}
}

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>sendou.ink</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.a93ba1fd.chunk.js"></script><script src="/static/js/main.ac2727ea.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>sendou.ink</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.a93ba1fd.chunk.js"></script><script src="/static/js/main.628479b6.chunk.js"></script></body></html>

View File

@@ -1,6 +1,6 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "2888015a4b3a54fccc9f3a16f77b7756",
"revision": "3d2f17cfe138bf612f48c03b2a06ae0b",
"url": "/index.html"
},
{
@@ -8,8 +8,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/2.a93ba1fd.chunk.js"
},
{
"revision": "4bb79fe496bf6dbdbe0e",
"url": "/static/js/main.ac2727ea.chunk.js"
"revision": "239a743b4958e5de726f",
"url": "/static/js/main.628479b6.chunk.js"
},
{
"revision": "42ac5946195a7306e2a5",

View File

@@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.0/workbox-sw.js");
importScripts(
"/precache-manifest.9c2970ab19939ec2b3ea214716e54fe9.js"
"/precache-manifest.147193d7011663af7c5ac1c1c31f14fa.js"
);
self.addEventListener('message', (event) => {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -18,7 +18,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "react-scripts build && move build ../public",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
@@ -36,5 +36,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"proxy": "http://localhost:3001"
}

View File

@@ -8,7 +8,7 @@ import { InMemoryCache } from 'apollo-cache-inmemory'
import { setContext } from 'apollo-link-context'
const httpLink = createHttpLink({
uri: 'http://localhost:3001/graphql',
uri: '/graphql',
})
const authLink = setContext((_, { headers }) => {