Skip to content

evantianx/tinyhouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TINYHOUSE

TypeScript

ts config

ts config

How to watch and reload ts-node when TypeScript files change

{
  "scripts": {
    "start": "nodemon src/index.ts"
  }
}

This is it! nodemon and ts-node

tsc

By invoking tsc with no input files and a --project (or just -p) command line option that specifies the path of a directory containing a tsconfig.json file, or a path to a valid .json file containing the configurations.

tsc -p ./

eslint

typescript-eslint

curl

man page

GraphQL

  • intuitive: client specifies exactly what data it needs
  • performant: no useless data needs to be transferred
  • typed: every field in the schema is type-defined
  • self-documenting
  • single endpoint

Resolver

  • Arguments
    • obj - object returned from the parent resolver
    • args - arguments provides to the field
    • context - value provided to every resolver
    • info - info about the execution state of the query

Proxying API Requests in Development

Routing

Server-side routing

  • Pros

    • only request the webpage that the user is viewing
    • initial page will be faster
    • improved SEO
  • Cons

    • every URL change will result in a full-page refresh
    • data that doesn't change might be requested over and over again

Client-side routing

  • Pros

    • navigate between routes is extremely fast
    • no white screen flash when waiting for a page to load
  • Cons

    • the whole web app needs to be loaded on the first request
    • serch engine crawling is less optimized

TODO

  • Use passport.js as Google OAuth 2
    • another alternative method grant
  • Switch to TypeORM and TypeGraphQL

MongoDB

Indexes

Without indexes, MongoDB must perform a clollection scan(i.e. scan for every document in a collection) to select the documents that match a query statement.

When we define an index for a certain field, we tell the database to create a different data structure to store the values of that field for every document in the collection.

MongoDB indexes use a B-tree data structure.

  • default _id index

    • MongoDB automatically creates a unique index on the _id field during the creation of a collection.
    • The _id index is unique.
    • MongoDB also offers many other different index types such as geospatial, text, etc.

Cloud-Based Image Management Service

  • we don't have to store images directly in our database anymore
  • can make our app more responsive since we don't have to query large amounts of image data

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published