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 { HandleError } from "./handleError"; | |
import { Service } from "./service"; | |
import { main } from "./app"; | |
const handleError = new HandleError(); | |
const service = new Service(); | |
main(handleError, service); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Webpack Tutorial</title> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" /> | |
</head> |
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 { HandleError } from "./handleError"; | |
import { Service } from "./service"; | |
import { main } from "./app"; | |
const handleError = new HandleError(); | |
const service = new Service(); | |
main(handleError, service); |
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 getName = document.getElementById("name"); | |
const getUserId = document.getElementById("userId"); | |
const registerButton = document.getElementById("register"); | |
const getResult = document.getElementById("result"); | |
const errorBox = document.getElementById("error"); | |
const checkLettersOnly = input => { | |
if (/^[a-zA-Z]+$/.test(input)) { | |
return true; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Webpack Tutorial</title> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" /> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" /> | |
</head> |
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 { MiddlewareFn } from "type-graphql"; | |
import { verify } from "jsonwebtoken"; | |
import { MyContext } from "./MyContext"; | |
//format like bearer 21321n2bmbbj | |
export const isAuth: MiddlewareFn<MyContext> = ({ context }, next) => { | |
const authorization = context.req.headers["authorization"]; | |
if (!authorization) { |
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 { Entity, PrimaryGeneratedColumn, Column, BaseEntity } from "typeorm"; | |
import { ObjectType, Field, ID } from "type-graphql"; | |
@ObjectType() | |
@Entity() | |
export class User extends BaseEntity { | |
@Field(() => ID) | |
@PrimaryGeneratedColumn() | |
id: number; |
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 "reflect-metadata"; | |
//import { createConnection } from "typeorm"; | |
import express from "express"; | |
//import { User } from "./entity/User"; | |
import { ApolloServer } from "apollo-server-express"; | |
import { Resolver, Query, buildSchema } from "type-graphql"; | |
@Resolver() | |
class Hello { | |
@Query(() => String) |
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
function App() { | |
const [search, setSearch] = React.useState(""); | |
const [query, setQuery] = React.useState(""); | |
return ( | |
<div className="App"> | |
<h1>Search for Books on any Topic</h1> | |
<form | |
onSubmit={e => { | |
e.preventDefault(); | |
setQuery(search); |
NewerOlder