This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Route, Switch } from "react-router-dom"; | |
import Navbar from "./Navbar"; | |
import Home from "./pages/Home"; | |
import GameIndex from "./pages/GameIndex"; | |
import "bulma/css/bulma.css"; | |
const App = () => ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs"); | |
const path = require("path"); | |
// We'll be in the /build dir when this runs, so we find the template | |
// file relative to /build. | |
const htmlTemplateFilename = path.resolve( | |
__dirname, | |
"..", | |
"src", | |
"server", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang=""> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta charset="utf-8" /> | |
<title>Boardaki</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<script | |
defer | |
src="https://use.fontawesome.com/releases/v5.3.1/js/all.js" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import express from "express"; | |
import { StaticRouter } from "react-router-dom"; | |
import { renderToString } from "react-dom/server"; | |
import App from "./common/App"; | |
import render from "./server/render"; | |
const server = express(); | |
server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { hydrate } from "react-dom"; | |
import { BrowserRouter } from "react-router-dom"; | |
import App from "./common/App"; | |
hydrate( | |
<BrowserRouter> | |
<App /> | |
</BrowserRouter>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npx create-razzle-app boardaki |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'functions.php'; | |
require_once 'validation/rules.php'; | |
require_once 'validation/Validator.php'; | |
$validator = Validator::make($rules, $_POST); | |
if ($validator->isAllValid()) { | |
header('Location: /thank-you.php?lang=' . lang()); | |
die(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$messages = [ | |
'en' => [ | |
// ... | |
'error_required' => '{field} is required', | |
'error_required_name' => 'Please enter your name', | |
'error_required_agree_to_terms' => 'Please agree to terms and conditions', | |
'error_email' => 'Please enter a valid email address', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once dirname(__FILE__) . '/../i18n/I18n.php'; | |
class Validator | |
{ | |
// ... | |
private function getErrorText($field, $rule, $arg) | |
{ | |
$key = I18n::hasKey("error_{$rule}_{$field}") ? |