biantris / biantris/koa-server

new architecture

Open
#128 0 comments 1 reaction 0 assignees View on GitHub
architecture enhancement
Dominant language
TypeScript
Stars
53
Forks
1
PR merge metrics
No merged PRs in 30d

Description

## koa server overview
Future implementation under development for the server
![image](https://user-images.githubusercontent.com/65451957/172018763-bd6656cc-3fc5-4848-896c-84fb79ac850e.png)

### GraphQL
- GraphQL + Relay gives us great power over what we call data queries.

### Types
- As an example we have the component `EventType` where we pass all the fields that this type can receive:
- name;
- start;
- end;
- allDay; ...etc.

```graphql
const EventType = new GraphQLObjectType({
name: "Event",
description: "event data",
fields: () => ({
id: globalIdField("Event"),
name: {
type: GraphQLString,
resolve: event => event.name,
},
start: {
type: GraphQLString,
resolve: event => event.start.toISOString(),
},
end: {
type: GraphQLString,
resolve: event => event.end.toISOString(),
},
allDay: {
type: GraphQLBoolean,
resolve: event => event.allDay,
},
}),
interfaces: () => [nodeInterface],
});
```
### Connection
[wip]

### Mutations
- Used to modify/edit some data
- Ex: edit a user name, remove, create a new one

### Loaders
- These are components that use dataloader to batch and caching the calls to mongo. In other words, this reduces requests to the backend
- Caching: caching certain data
- Batching: processes that data

Read more about it here: https://github.com/graphql/dataloader

### MongoDB
#### Models
- They tell `mongoDB` how the data should be structured. mongoDB doesn't have schemas so we use `moongose` to tell the database how we want to structure it

### Jobs
[wip]
- Run certain events in Queues
- see more https://github.com/biantris/koa-server/issues/127

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.