mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-07 19:55:46 -05:00
another middleware order
This commit is contained in:
25
index.js
25
index.js
@@ -630,6 +630,19 @@ const server = new ApolloServer({
|
||||
const app = express()
|
||||
|
||||
app.use(cors())
|
||||
|
||||
//https://stackoverflow.com/questions/8605720/how-to-force-ssl-https-in-express-js/31144924#31144924
|
||||
|
||||
function requireHTTPS(req, res, next) {
|
||||
// The 'x-forwarded-proto' check is for Heroku
|
||||
if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV !== "development") {
|
||||
return res.redirect('https://' + req.get('host') + req.url)
|
||||
}
|
||||
next()
|
||||
}
|
||||
|
||||
app.use(requireHTTPS)
|
||||
|
||||
app.use(express.static('build'))
|
||||
|
||||
//https://www.npmjs.com/package/express-session
|
||||
@@ -670,18 +683,6 @@ app.get('*', (req, res) => {
|
||||
res.sendFile(path.resolve(__dirname, 'build', 'index.html'))
|
||||
})
|
||||
|
||||
//https://stackoverflow.com/questions/8605720/how-to-force-ssl-https-in-express-js/31144924#31144924
|
||||
|
||||
function requireHTTPS(req, res, next) {
|
||||
// The 'x-forwarded-proto' check is for Heroku
|
||||
if (!req.secure && req.get('x-forwarded-proto') !== 'https' && process.env.NODE_ENV !== "development") {
|
||||
return res.redirect('https://' + req.get('host') + req.url)
|
||||
}
|
||||
next()
|
||||
}
|
||||
|
||||
app.use(requireHTTPS)
|
||||
|
||||
const PORT = process.env.PORT || 3001
|
||||
app.listen({ port: PORT }, () => {
|
||||
console.log(`Server running on http://localhost:${PORT}${server.graphqlPath}`)
|
||||
|
||||
2
react-ui/src/App.js
vendored
2
react-ui/src/App.js
vendored
@@ -3,7 +3,7 @@ import { Container } from 'semantic-ui-react'
|
||||
import Footer from './components/Misc/Footer'
|
||||
import MainMenu from './components/Misc/MainMenu'
|
||||
import NotFound from './components/Misc/NotFound'
|
||||
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
|
||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'
|
||||
|
||||
import WeaponLeaderboardSelector from './components/XLeaderboard/WeaponLeaderboardSelector'
|
||||
import XSearch from './components/XSearch/XSearch'
|
||||
|
||||
Reference in New Issue
Block a user