Server Side, REST & graphQL Flashcards

1
Q

HTTP Header Query Methods:

A

GET

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

HTTP Header Mutation Methods:

A

POST, PUT, PATCH, DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Status codes 1xx, 2xx, 3xx, 4xx, 5xx types

A

1xx: Informational
2xx: Success
3xx: Redirection
4xx: Client Error
5xx: Server Error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

REST stands for:

A

REpresentational State Transfer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Status code meanings:

200, 201

A

200: Everything went well
201: A resource was created properly
(probably from a PUSH request)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Status code meanings:

307

A

This resource has moved temporarily

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Status code meanings:

404, 500

A

404: You requested a nonexistent resource
500: Something went wrong server side (general error)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RESTful heuristics tips: (verbs/plurals)?

A

Don’t use verbs in the restful url, use the correct HTTP method instead
Use plurals for collections, followed by an :id for the specific item
All lowercase
Don’t use spaces or underscores. Use hyphens
No file extensions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

REST disadvantages

A

Can be a lot of endpoints
Can ‘over-fetch’ whole objects when you only need a small part
Need to know what the end user will request, so you can design the end points

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

REST advantages

A

Very familiar standard structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

import and initialize express server

A

const express = require(“express”);

const setupServer = () => {
  const app = express();
  app.get("/api/pokemon", (req, res) => {
res.send(pokeData);   });

return app;
};

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

graphQL benefits

A

prevents overfetching and underfetching

is kind of ‘self documenting’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

types of graphQl operations

A

queries (asks for data. Let GET)

mutations (alters data, like POST, PUT, PATCH, DELETE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Two parts of graphQL server:

A

schema

resolver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

graphQl schema and resolver example (for orders)

A

Schema:
type Query {
order (id: Int): Order
}

Resolver:
order (params) => {

return order
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

GraphQL data types

A

Int: A signed 32‐bit integer.
Float: A signed double-precision floating-point value.
String: A UTF‐8 character sequence.
Boolean: true or false.
ID: often used to refetch an object or as the key for a cache

17
Q

graphQL non null (eg: a string)

A

String!

18
Q

graphQL array of types (eg: Int)

A

[Int]

19
Q

CRUD = ?

A

Create, Read, Update, Delete