An open API service indexing awesome lists of open source software.

https://github.com/hsnice16/interview-experience-backend

Backend for Interview Experience using Node.js, GraphQL, and PostgreSQL
https://github.com/hsnice16/interview-experience-backend

apollo apollo-server graphql graphql-server node-postgres nodejs pg postgresql ts-node-dev typescript

Last synced: 3 months ago
JSON representation

Backend for Interview Experience using Node.js, GraphQL, and PostgreSQL

Awesome Lists containing this project

README

          

interview experience logo

# ✨ Interview Experience Backend

Backend for Interview Experience

![Forks](https://img.shields.io/github/forks/hsnice16/interview-experience-backend)
![Stars](https://img.shields.io/github/stars/hsnice16/interview-experience-backend)
![GraphQL](https://img.shields.io/badge/graphql-f6009b?logo=graphql)
![Node.JS](https://img.shields.io/badge/node.js-046e01?logo=node.js)
![TypeScript](https://img.shields.io/badge/typescript-gray?logo=typescript)

---

## 👀 Query

1. Get all the blogs.

```graphql
query Query {
blogs {
_id
author {
name
profile
}
forOrganization
link
title
}
}
```

2. Get all the blogs for an organization.

```graphql
query Query($filter: BlogFilter) {
blogs(filter: $filter) {
author {
name
profile
}
_id
forOrganization
link
title
}
}

{
"filter": {
"forOrganization": "Google"
}
}
```

3. Get paginated blogs.

```graphql
query Query($limit: Int!, $offset: Int!) {
blogs(limit: $limit, offset: $offset) {
author {
name
profile
}
_id
forOrganization
link
title
}
}

{
"limit": 4,
"offset": 2
}
```

4. Get all the organizations.

```graphql
query Query {
organizations {
_id
blogCount
name
}
}
```

5. Get paginated organizations.

```graphql
query Query($offset: Int!, $limit: Int!) {
organizations(offset: $offset, limit: $limit) {
_id
blogCount
name
}
}

{
"limit": 4,
"offset": 2
}
```

6. Get staging blogs.

```graphql
query Query($status: String!) {
stagingBlogs(status: $status) {
_id
author {
name
profile
}
forOrganization
status
link
title
}
}

{
"status": "pending"
}
```

---

## 🏗️ Mutation

1. Create a new blog.

```graphql
mutation Mutation(
$title: String!
$link: String!
$forOrganization: String!
$author: NewAuthor!
) {
createBlog(
title: $title
link: $link
forOrganization: $forOrganization
author: $author
) {
_id
status
author {
name
profile
}
forOrganization
link
title
}
}

{
"title": "blog-title",
"link": "blog-link",
"forOrganization": "blog-forOrganization",
"author": {
"name": "author-name",
"profile": "author-profile"
}
}
```

2. Update the new blog status.

```graphql
mutation Mutation($id: ID!, $status: String!) {
updateBlogStatus(_id: $id, status: $status) {
_id
author {
name
profile
}
forOrganization
link
status
title
}
}

{
"id": "new_blog_000",
"status": "rejected"
}
```

---

## 🔌 Getting Started

1. Clone the repository on your local machine with the command below in your terminal, and cd into the **interview-experience-backend** folder.

```shell
git clone https://github.com/hsnice16/interview-experience-backend.git

cd interview-experience-backend
```

2. Install dependencies (if you are using **yarn** then do with that).

```shell
npm install
```

3. Start the development server.

```shell
npm run watch
```