External Publication
Visit Post

25. Build Your Own API

DEV Community [Unofficial] June 16, 2026
Source

BootCamp by Dr.Angela

1. Building Your Own APIs

  • You can build your own APIs using frameworks like Node.js + Express.
  • API Platforms
    • RapidAPI : Marketplace for testing and using public APIs
    • APIs can be:
    • Monetized APIs : Data collection services, Algorithm / service-based APIs, Simplified interface for complex systems
    • Internal APIs (Private APIs) : Used only within a company or application
  • What Makes an API RESTful?
    • A RESTful API follows these principles:
    • Uses HTTP methods (GET, POST, PUT, PATCH, DELETE)
    • Returns data in JSON format
    • Follows Client–Server architecture
    • Is stateless (each request is independent)
    • Is resource-based (everything is treated as a resource)
    • Operates over the web (HTTP/HTTPS)

2. Creating GET, POST, PATCH, and DELETE Routes

  • Express Routes Overview : In Express, routes define how the server responds to client requests.
  • Route Parameters(:) : Used to capture dynamic values from the URL.
    • ex) app.get("/users/:id", (req, res) => { console.log(req.params.id); });
    • :id → dynamic parameter
    • Accessed via req.params
  • Callback Functions in Array Methods : Commonly used when working with data in APIs(find, filter, findIndex, ...)
    • ex) const user = users.find(user => user.id === 1);
  • PUT vs PATCH
    • PUT : Replace entire resource, Update full object
    • PATCH : Modify part of resource, Partial update
  • DELETE Operation : Used to remove data from a collection.
    • ex) users.splice(index, 1);
    • splice() : removes elements from an array , Commonly used for delete logic in in-memory data

Discussion in the ATmosphere

Loading comments...