A progressive Node.js framework for building efficient and scalable server-side applications.
An Graphql based api where user can read, create, delete product & listen for realtime notification about newly created & deleted product
Types
type Delete {
id: String!
deleted: Boolean!
}
type Transaction {
id: String!
quantity: Int!
time: String!
status: String!
}
type Product {
id: String!
transactions: [Transaction!]!
}
Queries
type Query {
products: [Product!]!
product(id: String!): Product!
}
Mutations
type Mutation {
createProduct(quantity: Int!): Product!
deleteProduct(id: String!): Delete!
}
Subscriptions
type Subscription {
createdProduct: Product!
deletedProduct: Delete!
}
Get All Products
query products {
products {
id
transactions {
id
quantity
time
}
}
}
Get a specific product
query product {
product(id: "8e532ef8-88a2-44eb-8683-632badc2d106") {
id,
transactions{
id,
quantity,
time
}
}
}
Create a product
mutation createProduct{
createProduct(quantity: 14) {
id,
transactions{
id,
quantity,
time
}
}
}
Delete a specific product
mutation deleteProduct{
deleteProduct(id: "8e532ef8-88a2-44eb-8683-632badc2d106") {
id,
deleted
}
}
Real time notification - If any product is created
subscription createdProduct{
createdProduct{
id,
transactions{
id,
quantity,
time
}
}
}
Real time notification - If any product is deleted
subscription deletedProduct {
deletedProduct{
id,
deleted
}
}
Nest framework TypeScript starter repository.
$ npm install# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covNest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
Nest is MIT licensed.