Skip to content

First App

pdm app start-app demo

Settings config/settings.py (Demo)

Installed Apps

After creating your first demo app. Add it in the applications list "INSTALLED_APPS"

config/settings.py
# -*- coding: utf-8 -*-
import pathlib

# Base Directory
BASE_DIR = pathlib.Path(__file__).parents[1]

# Installed Apps
INSTALLED_APPS = ["demo"] # (1)
  1. INSTALLED_APPS - Right now we control the INSTALLED_APPS from here. However, depending on mode in the spoc.toml is where you place them.

Run

Start the Server (Again). After adding your App to INSTALLED_APPS.

pdm app run

Then go to http://127.0.0.1:8000/graphql

GraphQL

IF its working it should look something like the image below.

GraphQL

Testing

Info

Copy the code below and paste it the browser's editor.

query MyQuery {
  detail(item: { id: "fake-id", ids: ["fake-id"] })
  search(pagination: { limit: 10, page: 10, sortBy: "id", all: false })
}

GraphQL-Demo

Response

Info

After running the query. The editor should return the json below

{
  "data": {
    "detail": "Detail",
    "search": "Search"
  }
}