Services and Routes

Kong Course · lesson 2 of 15 · 5 min read

Kong's whole data model in two objects - and you learn it by sending requests at it.

Open this lesson in the learning hub

Key points

  • A Service is the upstream you are protecting: a name plus a URL.
  • A Route is a rule that says which incoming requests go to that service.
  • One service usually has several routes; a route belongs to exactly one service.
  • A route matches only when every condition it declares matches the request.
  • Nothing is proxied unless some route matches - no match means 404 from Kong, not your service.

Example

_format_version: "3.0"

services:
  - name: orders
    url: http://orders.internal:8080
    routes:
      - name: orders-api
        paths: [ /orders ]
        methods: [ GET, POST ]

  - name: billing
    url: http://billing.internal:8080
    routes:
      - name: billing-api
        paths: [ /billing ]

A Service is where traffic goes; a Route decides what gets sent there. No match, no proxy.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.