Code Monkey home page Code Monkey logo

interview-lob's Introduction

Getting started

  1. Install npm and node.js. I used Node v 14.17, but I expect any reasonably modern version would work just fine.
  2. Clone the repo.
  3. Install dependencies
npm i
  1. Run the app.
npm start

Or

node bin/www

The app should now be running at http://localhost:3000

API

GET /address/search/street?lineOne=string&lineTwo=string

Search by street address. LineTwo is optional.

GET /address/search/city?city=string

Search by city.

GET /address/search/state?state=string

Search by state.

GET /address/search/zip?zip=string

Search by zip code.

GET /address/:id

Get a single address block by id.

POST /address

Add an address to the list. The body is the address object as JSON.

PUT /address/:id

Update the values of the address by id.

DELETE /address/:id

Remote an address from the list by id.

Tradeoffs, In no particular order:

  • There is no data store. The repository pattern would make it fairly painless to replace the simple memory store with a persistent database. Or at least the API probably wouldn't need to change.
  • I didn't write any tests. Normally I would, but it's been more than 2 hours already. I'm not in the habit of setting up projects from scratch.
  • Route handlers can be injected, but Express doesn't make that straightforward to do. On a large project, it's very worth doing, anyway.
  • There are no error handlers. There really should be.
  • A real operational app should provide better observability than just the basic logging this does.
  • It's nice to have babel transpilation for some of Node's missing ES6 features. I especially prefer to use module imports over node require, but it's too much extra complication for an interview project.
  • There is no validation, and there really should be. Some would be provided by an RDBMS, but ideally the app would do its own validation first.
  • Ideally the app would expose an OpenAPI spec and live UI, but again that is a bit of extra work to set up on Express.
  • Functionally, it would be reasonable to search by multiple fields. City + state , or Street address + city, for example. This would require a more complicated search function.
  • If the data store backing this is an RDBMS, then configuring indexes to make these searches perform reasonably well would be complicated. Currently every field is searchable, but indexing every field is likely to give the same or worse performance as having no indexes at all.
  • There's no IAM mechanism here, and a client's identity should be considered when doing these searches and crud operations.

interview-lob's People

Contributors

jenniferplusplus avatar

Watchers

 avatar  avatar

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.