Skip to content

Instantly share code, notes, and snippets.

@ra100
Last active July 30, 2019 03:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ra100/5ca8e284d3efb3ad0e578caed55cbfc3 to your computer and use it in GitHub Desktop.
Save ra100/5ca8e284d3efb3ad0e578caed55cbfc3 to your computer and use it in GitHub Desktop.
Node.js homework

Task

Implement API server (in Node.js) based on the API specification.

It shouldn't take more than one hour to do this.

We like:

  • Tests
  • Nice commit messages
  • Working code
  • Readme

Aditional notes:

  • You can use TypeScript or newer ES, we use either of these
  • Best way how to share the code with us is to create new GitHub repo. Regardless of success in our interview, you can then at least use the repo for other interviews :)
  • You don't have to finish everything. If you don't, just put there a comment describing your intent and we can then discuss it during the interview
openapi: 3.0.0
info:
description: ""
version: 1.0.0
title: Shipyard
paths:
/ships:
post:
summary: Add ship to shipyard
description: ""
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Ship"
description: Ship object to be added to shipyard
required: true
responses:
"201":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/ShipWithId"
get:
summary: Fetches list of Ships
description: ""
responses:
"200":
description: successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/ShipArray"
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://localhost:4242/v1
components:
schemas:
Ship:
type: object
required:
- name
- speed
properties:
name:
type: string
example: Enterprise D
speed:
type: string
example: Warp 9
ShipWithId:
allOf:
- $ref: "#/components/schemas/Ship"
- properties:
id:
type: number
example: 1
ShipArray:
type: array
items:
$ref: "#/components/schemas/ShipWithId"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment