Coder Social home page Coder Social logo

simple-crud-api's Introduction

Simple CRUD API


Description of the task see here.


Commands for running the application (via npm):

  • npm run start:dev - run in development mode (using nodemon, ts-node);
  • npm run start:prod - build a bundle (using webpack) and run in production mode;
  • npm run start:multi - build bundle and turn on horizontal scaling for the app (using cluster api);
  • npm run start:multi-dev - the same as previous script except for building a bundle (running with nodemon);
  • npm run test- run tests (usingjest, supertest).

There is also .env.example file in root directory with example of how should look your .env file.

If you don't create .env, port will be set 4000 by default.

User model:

{
  id: string;
  username: string;
  age: number;
  hobbies: string[];
}

Available endpoints:

  • GET api/users - get array of all users;

  • GET api/users/${userId} - get object with user data by id;

  • POST api/users - create new user (*);

  • PUT api/users/${userId} - update user data by id (*);

  • DELETE api/users/${userId} - delete user by id.

    (*) - object with username, age, hobbies must be passed in body. Unique id is assigned automatically.

Clarification:

  • endpoint api/users/ is considered invalid (api/users is expected);
  • excess properties (all except username, age, hobbies) are ignored in POST, PUT requests;
  • you must pass all required properties in POST, PUT requests, otherwise an error will be received.

simple-crud-api's People

Contributors

kvchvn 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.