Git Product home page Git Product logo

node-crud-api's Introduction

CRUD API

TypeScript Node.js Jest

A simple CRUD API server created using the core node:http module that uses an in-memory database. Also implemended a multi-threaded mode with a load balancer that distributes incoming requests between several REST-server instances using the round-robin algorithm.

API reference

Endpoint Description
GET /api/users Get all users
GET /api/users/{user_id} Get user by id
POST /api/users Create a new user
PUT /api/users/{user_id} Update user by id
DELETE /api/users/{user_id} Delete user by id

Run server locally

You must have Node.js installed on your computer

1. Clone this project locally

# by SSH
git clone [email protected]:sashua/node-crud-api.git

# or HTTPS
git clone https://github.com/sashua/node-crud-api.git

2. Go to the project directory

cd node-crud-api

3. Switch to dev branch and install dependencies

git checkout dev
npm install

4. Create .env file and set PORT environment variable (default port is 3000 if not specified)

echo "PORT=4000" > .env

5. Run the server in single- or multi-threaded mode

# single-threaded mode
npm run start:prod

# multi-threaded mode with load balancer
npm run start:multi:prod

* You can run tests by typing

npm run test

Notes

This project was created as part of the "Node.js" course

Assignment description

RS School

node-crud-api's People

Contributors

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