Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ dist

# TernJS port file
.tern-port

server/.env

1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm --prefix ./server deploy
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react';
import { useNavigate , useParams } from 'react-router-dom'
import Utils from '../pages/Utils/Utils'
import Utils from './Utils/Utils'
import '../App.css'
let randomWords = require('../API/randomWords');

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "./server/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1" ,
"start" : "npm --prefix ./server start" ,
"deploy" : "npm --prefix ./server deploy"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.1",
"cors": "^2.8.5",
"dotenv": "^11.0.0",
"express": "^4.17.2",
"mongoose": "^6.1.6",
"path": "^0.12.7",
"random-number": "^0.0.9",
"random-words": "^1.1.1"
}
}
6 changes: 5 additions & 1 deletion server/configs/dataBase.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require("dotenv").config();
var mongoose = require('mongoose');
const MongoDbUrl = process.env.PRODUCTION === "True" ? process.env.MONGODB_URL : 'mongodb://localhost:27017/gamesDB'
console.log(MongoDbUrl)

mongoose.connect('mongodb://localhost:27017/gamesDB',{

mongoose.connect(MongoDbUrl ,{
useNewUrlParser: true,
useUnifiedTopology: true
})
12 changes: 12 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require("dotenv").config();
const path = require("path");
var express = require('express');
var api = require('./routes/api');

Expand All @@ -11,6 +13,16 @@ var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true })).use(bodyParser.json());
app.use(cors());

if(process.env.PRODUCTION === "True")
{
app.use(express.static(path.join(__dirname,'../client' , 'build')));


app.get('*', (req, res) => {
res.sendFile(path.join(__dirname,'../client' , 'build', 'index.html'));
});
}

app.use('/games' , api);

app.listen(8000, () => {
Expand Down
74 changes: 74 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1" ,
"start" : "node index.js" ,
"deploy" : "npm install && npm start"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.19.1",
"cors": "^2.8.5",
"dotenv": "^11.0.0",
"express": "^4.17.2",
"mongoose": "^6.1.6",
"path": "^0.12.7",
"random-number": "^0.0.9",
"random-words": "^1.1.1"
}
Expand Down