Coder Social home page Coder Social logo

xyz-parking-lot's Introduction

XYZ PARKING LOT

Prerequisites

  • Node.js 16 and up

Run Locally

Clone the repository and install node packages

git clone https://github.com/adrian-azu/xyz-parking-lot.git
cd xyz-parking-lot
npm install

Start the server

  npm start:dev

Try requesting with postman http://locahost:3000/

API Reference

POST /parking-lot POST /parking-lot/find-slots POST /parking-lot/add-time POST /vehicle/park POST /vehicle/unpark

CREATE PARKING LOT

  POST /parking-lot
Parameter Type Description
entrance number Required. Number of entrance
slots number Required. Number of slots per entrance

GET PARKING LOT MAP

  GET /parking-lot

FIND AVAILABLE SLOTS

    POST /parking-lot/find-slots
Parameter Type Description
entrance number Required. Entrance number vehicle entered
sizes number Required. Size of the vehicle

@return { Slot, VehicleId }

PARK VEHICLE

    POST /vehicle/park
Parameter Type Description
slot Object Required. Slot returned on FIND AVAILABLE SLOT API
vehicleId number Required. VehicleId returned on FIND AVAILABLE SLOT API

PARK VEHICLE

    POST /vehicle/unpark
Parameter Type Description
vehicleId number Required. VehicleId of the parked vehicle

ADD TIME

    POST /parking-lot/add-time
Parameter Type Description
time number Required. Time count to be added
dateType string Required. Date time adjustment type. enum: [days, hours, minutes]

Built With

  • Node.js
  • Express

Map Visualization

ENTRANCE: A, B, C
SLOTS: 9
A
+----+----+----+
| A1 | A2 | A3 |
+----+----+----+
| A4 | A5 | A6 |
+----+----+----+
| A7 | A8 | A9 |
+----+----+----+
B
+----+----+----+
| B1 | B2 | B3 |
+----+----+----+
| B4 | B5 | B6 |
+----+----+----+
| B7 | B8 | B9 |
+----+----+----+
C
+----+----+----+
| C1 | C2 | C3 |
+----+----+----+
| C4 | C5 | C6 |
+----+----+----+
| C7 | C8 | C9 |
+----+----+----+
\*/

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.