Giter VIP home page Giter VIP logo

crud-api's Introduction

Simple RESTful CRUD API

It is a scalable API that handles CRUD requests out of the box. However, with the help of a recursive algorithm baked inside, it is becoming very easy to design deeply nested subdomains with their own custom handlers.

Tech stack: Typescript, Node.js

To run locally:

  1. Clone this repo
  2. bash npm i && npm run start

How to communicate with the API

Endpoint Method Description
/api/users GET Retrieves all user records. Returns a status code of 200 and the user records.
/api/users/{userId} GET Retrieves a specific user record by ID. Returns a status code of 200 and the user record if found, or a status code of 400 if the ID is invalid or 404 if the record doesn't exist.
/api/users POST Creates a new user record. Returns a status code of 201 and the newly created record. Server will answer with status code 400 and corresponding message if request body does not contain required fields
/api/users/{userId} PUT Updates an existing user record. Returns a status code of 200 and the updated record. However server will answer with the
/api/users/{userId} DELETE Deletes an existing user record. Returns a status code of 204 if the record is found and deleted.

Additional Info:

  • Users are stored as objects with properties:

    • id: unique identifier (string, uuid) generated on the server side
    • username: user's name (string, required)
    • age: user's age (number, required)
    • hobbies: user's hobbies (array of strings or empty array, required)
  • Requests to non-existing endpoints are handled with a status code of 404 and a corresponding human-friendly message.

  • Errors on the server-side are handled with a status code of 500 and a corresponding human-friendly message.

crud-api's People

Contributors

ashtotakoe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.