Giter VIP home page Giter VIP logo

coding-test's Introduction

Nest.js Coding Test

A coding test I completed for a certain hosting company. This was my first time using Nest.js to build a web application.
I used multple methods of doing things, so it may seem a little messy but I wanted to learn everything possible and see which I like the most.

Running the application

MacOS & Linux

  • Clone this repository
  • Run yarn install
  • Configure .env
  • Run yarn start

Goals

Create a simple web application with Nest.js where you can register, update, and get information on "birdhouses".

Endpoints

POST /house

  • Request: { longitude: number, latitude: number, name: string }
  • Response: { id: uuid, ubid: uuid, birds: number, eggs: number, longitude: number, latitude: number, name: string } (201)

PATCH /house/:id

  • Request: { longitude: number, latitude: number, name: string }
  • Response: { birds: number, eggs: number, longitude: number, latitude: number, name: string } (200)

POST /house/:id/residency

  • Request: { birds: number, eggs: number}
  • Response: { birds: number, eggs: number, longitude: number, latitude: number, name: string } (201)

GET /house/:id

  • Response: { birds: number, eggs: number, longitude: number, latitude: number, name: string } (200)

Further Information

The birdhouses all supply the following header as authentication(except registering):
X-UBID: <UBID>

A UBID (Unique Birdhouse Identifier) is similar to a UUID.
Example: 69e03f88-2a05-4d8d-a540-073f8910aec5

All actions done in the API should be logged so all events that happened can be viewed.

Rules

  • Names of birdhouses can not be shorter than 4 and no longer than 16 characters
  • Endpoints that receive information from birdhouses must be secured and match the X-UBID header with a UBID of a sold birdhouse. Other endpoints do not need to be secured as they will be public.
  • Keep a history for birdhouse residence
  • Each birdhouse has a registration number, only real registration numbers can talk with these endpoints. Registration numbers/birdhouses can be added in bulk to the API. (very simple authentication)
  • Prune birdhouses that have not received an update in a year

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.