Skip to content

rsandipermana/sunbytes-codingame

Repository files navigation

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads CircleCI Coverage Discord Backers on Open Collective Sponsors on Open Collective Support us

Task Description

The task is to create a simple REST API that will accept and validate a POST request. The API should validate that:

  • Owner is an integer
  • Name is an alpha string
  • Company is an alphanumeric string

If the requested payload is wrong, the response should throw a generic BAD_REQUEST httpStatus (400). But in the server console, it should throw the actual validation result error. Screenshoot: deskripsi

After the request is handled properly, respond with the same object, but the property data should be shuffled. Screenshoot: deskripsi

Solution

Technologies Used

  • Nest.js framework
  • TypeScript

Requirements

  • Node.js

How to Run

  1. Clone the repository: git clone https://github.com/example/repo.git

  2. Install dependencies: cd sunbytes-codingame && npm install

  3. Start the server: npm run start:dev

The server will start on port 3000.

Endpoints

POST /test

Accepts a JSON object with the following properties:

  • owner: integer
  • name: string
  • company: string

Returns the same object with the data property shuffled.

Example Request:

{
    "owner": 12,
    "name": "Candidate",
    "company": "Sunbytes"
} 

Example Response:

{
    "owner": 21,
    "name": "idCandate",
    "company": "Stesunby"
}

Swagger

Swagger documentation can be accessed at http://localhost:3000/swagger/.

Screenshoot: deskripsi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors