fix: small admin fixes

This commit is contained in:
Taranto 2020-02-26 09:31:58 +00:00 committed by Josh Harvey
parent bde27cce4c
commit b1b8b82260
5 changed files with 41 additions and 43 deletions

View file

@ -1,4 +1,5 @@
const fs = require('fs')
const path = require('path')
const express = require('express')
const https = require('https')
const cors = require('cors')
@ -24,6 +25,7 @@ if (!hostname) {
const app = express()
app.use(helmet({ noCache: true }))
app.use(cookieParser())
app.use(express.static(path.resolve(__dirname, '..', '..', 'public')))
const apolloServer = new ApolloServer({
typeDefs,
@ -80,6 +82,9 @@ app.get('/api/register', (req, res, next) => {
})
})
// Everything not on graphql or api/register is redirected to the front-end
app.get('*', (req, res) => res.sendFile(path.resolve('client', 'build', 'index.html')))
const certOptions = {
key: fs.readFileSync(options.keyPath),
cert: fs.readFileSync(options.certPath)