Skip to content

Interview coding challenge: API with CRUD functionalities. Made with Node.

Notifications You must be signed in to change notification settings

ryanmargono/inHome_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README.md

Requirements

node version 13.5 or ESM compatibility.

Installation

yarn install

Execution

npm start

localhost:8080

The service will connect to the existing local database file inside src/db/inhome.db

Design Decisions

Folder Structure

├── src                   
│   ├── api # endpoint controllers
│   ├── db  # database file (empty orders and users to start off with)
│   ├── loaders # service start up logic
│   ├── models  # db models
│   ├── services    # endpoint business logic
│   └── app.js  # app entry point  

I took on this project as if I was building an application in the real world. Therefore, factors such as scale and testibility played a big part in how I structured the application.

Loaders split up start up logic into module with specific purposes. In this case, there is a loader file for initializing express and another for sequelize. By splitting these up, it allows an engineer to easily write tests for each module.

Seperating business logic from the endpoint controllers also benefits testing. If business logic wasn’t seperated, then writing tests for them would have to involve mocking request and response objects, which complicates the process. In addition, this seperation provides better readibility, which helps with a growing team as engineers need to quickly onboard.

Node + Express

Any commonly used backend framework would have done the trick. However, I have been working primarily with Django and Python in the back end for the last year and wanted to use this opportunity as a refresher for Node and JS.

Sequelize

Using an ORM sped up development time by abstracting away the need to write SQL queries directly.

Extra Credit

User Avatar

I used a random image generator API (Lorem Picsum) to get a URL for each user on creation.

Limitations and Improvements

* writing tests.
* more error handling.

About

Interview coding challenge: API with CRUD functionalities. Made with Node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published