Git Product home page Git Product logo

task-coffeemug-api's Introduction

About task-coffeemug-api

This was a recruitment task that I went overboard with (as usual ๐Ÿคฆ). It uses ExpressJs, NodeJS, Typescript, mongodb and docker-compose to start everything up without any hassle. Config is stored in .env file (one to rule them all) and propagated through the containers during build time. As a code formatter of choice I use xojs configured for my own needs (if you want to use it seamlessly install vscode extension xo).

The app consists of three containers:

  • database - straightforward mongodb docker instance
  • database seeding - it seeds db with sample data from database/seed/data/products.json
  • backend - it installs all dependencies, builds app from Typescript and serves it on port specified in .env file

How to run

  • Pull this repository: git pull https://github.com/Mannhattan/task-coffeemug-api.git

  • Copy .env.template contents to new .env file (and change variables if you need)

  • Start production build with docker-compose (database, seeding and backend containers): docker-compose up --build (add -d flag for detached mode) โš ๏ธ if you want to preserve db data then uncomment volumes line from docker-compose.yml โš ๏ธ

  • start dev environment (needs its own database and changes in .env file to accomodate that): npm run dev


Available routes

  • GET /api/v1/products - gets all products

  • GET /api/v1/products/:id - gets details about specific product

  • POST /api/v1/products/ - creates new product, saves it to database and returns it

  • PUT /api/v1/products/:id - updates existing product and returns it

  • DELETE /api/v1/products/:id - removes existing product from database


Things that should be added

  • tests
  • security
  • logging

Other things to note

  • all containers are connected in a network and only backend container exposes its port to external use
  • typescript lacks proper polish in some places

Bugs & bugfixes

Hopefully none at this point ๐Ÿ˜‰

task-coffeemug-api's People

Contributors

mannhattan avatar

Watchers

 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.