Skip to content

This is a rate limited parking slot server. Park, Unpark your car and see if praking slots are available or not.

Notifications You must be signed in to change notification settings

Swastikyadav/RateLimited-Parking-Slot-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Rate-Limited Parking slot server.

Note: This project uses no database. It only showcases the REST API implementation.

Installation

Install my-project with yarn. The following command will create node_modules and yarn.lock file.

  yarn

The following command will start the dev server.

  yarn dev

Running Tests

To run all the test cases, run the following command. Implemented test with Jest and Supertest.

  npm run test

API Reference

Get a car info

  GET /api/v1/car/:carNumber

Get a parking slot info

  GET /api/v1/slot/:slotNumber

Park a car

  POST /api/v1/car

Request Body

  {
      "carNo": 4567
  }

Unpark a car

  DELETE /api/v1/car/:carNumber

Rate Limiter

I have never implemented rate limiter before. So, did some research for that.

Did not use any external package.

Initially I implemented the rate limiter with redis to store the request count value.

But then, Removed the redis implementation and implemented it manually.

User can't request more than 10 times in 10 seconds.

Thank You!

About

This is a rate limited parking slot server. Park, Unpark your car and see if praking slots are available or not.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published