Giter Site home page Giter Site logo

eventmanager's People

Contributors

margierain avatar

Watchers

 avatar  avatar

eventmanager's Issues

How about using exceptions where errors occur

function deleteEvent(req, res) {

Example

[Event Controller]
function deleteEvent(req, res) {
DeleteService.delete(some-event-id);
return res.status(200) .. with some message
}

[Delete Service]

function Delete(id) {
const result = EventRepository.delete(id)
If(result === some failure)
throw SOMEEXCEPTION;
}

[SOMEEXCEPTION]
This basically handles the exception and decides what one can send back to the user depending on whether your on prod qa dev or test
We can talk about this

File does many things

function resolveError(err, res, status) {

Besides doing many things:

  1. Javascript already has an error / exception class, how could you use it (Custom errors). In addition if you were following a standard for api responses, it already defines a standard so you dont really need to think about how to structure the api
  2. Think the filtering can fall under a search service maybe

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.