Skip to main content

Introduction

Welcome to the Cog tutorial.
Cog is an ultra lightweight (23.5 kB unpacked) HTTP framework built directly on top of Node.js’s native http module. It aims to provide a minimal, yet powerful foundation for building backend servers and APIs — without any runtime dependencies.

If you’ve used frameworks like Express, you’ll feel right at home with Cog’s API.

What you’ll learn

In this tutorial, you will learn how to:

  • Create a simple HTTP server
  • Define routes and handle requests
  • Work with query strings and request bodies
  • Use middleware for reusable logic

Requirements

To follow this tutorial, you should have:

  • Basic knowledge of JavaScript or TypeScript
  • Node.js v18.15.0 or higher installed