Coder Social home page Coder Social logo

crud-api's Introduction

CRUD-API

https://github.com/AlreadyBored/nodejs-assignments/blob/main/assignments/crud-api/assignment.md

START

  1. git clone this repository

  2. checkout on dev branch

  3. copy and rename .env.template file as .env. Add data on it.

MAIN_PORT=4000
  1. npm i

If everything goes well, then a node_modules folder should appear.

  1. npm run start:dev

If everything goes well, then a message 🚀 Server ready on MAIN_PORT should appear in the console

  1. npm run start:prod

If everything goes well, then a dist folder should appear and message 🚀 Server ready on MAIN_PORT should appear in the console.

  1. npm run start:multi

If everything goes well, then a message 🚀 Server ready on MAIN_PORT and Worker NUMBER_OF_WORKER is now connected to http://localhost:{WORKER_PORT} should appear in the console.

TESTING

You can use, for example, Postman to test API.

!! Remember about request headers. You need 'content-type': 'application/json'.

GET http://localhost:MAIN_PORT/api/users

GET http://localhost:MAIN_PORT/api/users/{userId}

POST http://localhost:MAIN_PORT/api/users

PUT http://localhost:MAIN_PORT/api/users/{userId}

DELETE http://localhost:MAIN_PORT/api/users/{userId}

Structure of the body to create a new user.

!! All fields are required.

{
    "username": "Marry",
    "age": 20,
    "hobbies": [“hobbie1", "hobbie2"]
}

Structure of the body to update a user.

{
    "username": "MarryNewName",
    "age": 21,
    "hobbies": [“hobbie1", "hobbie2", "newHobbie"]
}

crud-api's People

Contributors

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