GithubHelp home page GithubHelp logo

message-board-backend's Introduction

Message Board Backend

About

This is a simple CRUD api for handling the messages within a fictional messaging board.

Getting started

In order to run this, you must download this repository locally, and have Docker installed.

docker build -t message-board-backend .
docker run -p 3000:3000 message-board-backend

Technical choices

I chose to use Express with Typescript, in a barebones setup. This, along with many other decisions, was due to time constraints. This means features such as logging and error handling are missing.

For storage, I've just used a JavaScript variable. It's not ideal, but to implement a database or persistent storage option would take too long, so I've tried to write in such a way that this can be added in quickly later.

I've included some unit tests for good measure. Given more time, adding some integration tests would be the highest priority IMHO, which would test the wiring of the application and whether I've set the routes up correctly.

I used Docker to avoid versioning issues, and because it's quick to set up.

Endpoints

There's a few endpoints here:

Get http://localhost:3000/ - Return all messages.

Get http://localhost:3000/:messageId - Return a message.

POST http://localhost:3000/ - Create a message e.g.

{
  "text": "hello world",
  "user": "foo"
}

PUT http://localhost:3000/:messageId - Update a message.

DELETE http://localhost:3000/:messageId - Delete a message.

Next steps

Improvements that I would recommend, if you wanted to make this production worthy:

  • Add integration / E2E tests
  • Make Docker image leaner
  • Add storage to the messages (probably SQL)
  • Add error handling / logging
  • CI/CD (AKA figuring out deployment...)
  • Security (authorisation and authentication)

Bonus:

Just if you've made it this far, please check out this repository I made, about 6 years ago. It's not got testing, TypeScript and other nice to haves, but might be a bit better example of what good looks like architecturally.

message-board-backend's People

Contributors

benwallman 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.