usu / nest-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

POC with NestJS

What's implemented so far:

  • 2 Entities (camps, perios) with 1:n relationship
  • Exposure of GraphQL (*.resolver.ts) and REST Endpoints (*.controller.ts)
  • Encapsulation of business logic in CRUD service layer (*.service.ts)
  • TypeORM entities (entities/*.entity.ts)
  • DTO for create and update (dto/*.inputs.ts)

Backend

Start backend:

cd backend
npm i
npm run start

GraphQL Endpoint

GraphQL Playground available at http://localhost:3000/graphql

Try this query, to load all camps and its periods:

query { camps {
  id,
  __typename,
  name,
  title,
  periods {
    id,
    __typename,
    description
  }
}}

Or try this to create a new camp:

mutation {
  createCamp(createCampInput: { name: "Test camp", title: "My test camp" }) {
    id
    __typename
    name
    title
    motto
  }
}

REST endpoints

REST endpoints are available at:

Frontend

nothing done so far

About


Languages

Language:TypeScript 80.5%Language:Vue 12.4%Language:JavaScript 4.1%Language:HTML 3.0%