View package.json
This file contains 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
{ | |
"name": "express-backend", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "nodemon index.js" | |
}, | |
"author": "", | |
"license": "ISC", |
View config.js
This file contains 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
let config = { | |
dbUrl: | |
"mongodb+srv://techomoro:password@cluster0.7cpxz.mongodb.net/posts?retryWrites=true&w=majority", | |
}; | |
module.exports = config; |
View posts.js
This file contains 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 express = require("express"); | |
const Post = require("../models/Post"); | |
const router = express.Router(); | |
router.post("/", async (req, res) => { | |
try { | |
let post = new Post(req.body); | |
post = await post.save(); | |
res.status(200).json({ | |
status: 200, |
View Post.js
This file contains 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 mongoose = require("mongoose"); | |
let Schema = mongoose.Schema; | |
let postSchema = new Schema( | |
{ | |
title: { | |
type: String, | |
}, | |
description: { | |
type: String, |
View index.js
This file contains 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 express = require("express"); | |
const app = express(); | |
const cors = require("cors"); | |
const bodyParser = require("body-parser"); | |
const logger = require("morgan"); | |
const mongoose = require("mongoose"); | |
mongoose.set("useNewUrlParser", true); | |
mongoose.set("useFindAndModify", false); | |
mongoose.set("useCreateIndex", true); |
View App.js
This file contains 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, { useEffect, useState } from "react"; | |
import AppContext from "./AppContext"; | |
import { Grid } from "@material-ui/core"; | |
import Header from "./components/Header"; | |
import WordList from "./components/WordList"; | |
import SelectDifficulty from "./components/SelectDifficulty"; | |
import Question from "./components/Question"; | |
import Result from "./components/Result"; |
View Result.jsx
This file contains 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, { useContext } from "react"; | |
import AppContext from "../AppContext"; | |
import { Link } from "@material-ui/core"; | |
import { zoomInUp } from "react-animations"; | |
import Radium, { StyleRoot } from "radium"; | |
export default function TransitionsModal() { | |
const value = useContext(AppContext); | |
let { trueOrFalse } = value; |
View Question.jsx
This file contains 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, { useContext } from "react"; | |
import AppContext from "../AppContext"; | |
import { makeStyles } from "@material-ui/core/styles"; | |
import { TextField, Button } from "@material-ui/core"; | |
const useStyles = makeStyles((theme) => ({ | |
root: { | |
width: "100%", | |
maxWidth: 360, |
View WordList.jsx
This file contains 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, { useContext } from "react"; | |
import AppContext from "../AppContext"; | |
import { makeStyles } from "@material-ui/core/styles"; | |
import List from "@material-ui/core/List"; | |
import ListItem from "@material-ui/core/ListItem"; | |
import ListItemText from "@material-ui/core/ListItemText"; | |
import { Divider, Typography, Button } from "@material-ui/core"; | |
const useStyles = makeStyles((theme) => ({ | |
root: { |
View SelectDifficulty.jsx
This file contains 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, { useContext } from "react"; | |
import AppContext from "../AppContext"; | |
import { makeStyles } from "@material-ui/core/styles"; | |
import List from "@material-ui/core/List"; | |
import { ListItem, Typography } from "@material-ui/core"; | |
import ListItemText from "@material-ui/core/ListItemText"; | |
import Divider from "@material-ui/core/Divider"; | |
const useStyles = makeStyles((theme) => ({ | |
root: { |
NewerOlder