Code Monkey home page Code Monkey logo

rest-api-ex's Introduction

Overview

My first significant code written in the Go Language.

Data is expected to live at https://s3-us-west-2.amazonaws.com/sample-coding-dataset/organization_sample_data.csv. This is hard-coded as a constant

The data consists of the fields id, name, city, state, postal, category with a header

All fields are strings except id, which is int.

Assumptions: The id field is unique.

Endpoint

GET /organizations?category=Greek&city=Washington

Fields

Id: numeric id Name: string : organization name City: string : US city name State: string : US state name Postal: string : US postal code Category: string : categorization of org

Additional query params

Orderby: string: fieldname to order the results by Direction: string: ASC or DSC

Dependencies

A simple http router https://github.com/julienschmidt/httprouter

Known Flaws

  • There's not much error handling
  • While HTTP query parameters could allow multiple values for the same parameter, this implementation only looks at the first one.
  • I'm not 100% sure I have Go's json encoding correct
  • The data structures are primitive, and the mapping from the csv table to data is not at all robust
  • It's not very idiomatic Go.

rest-api-ex's People

Contributors

cratermoon avatar

Watchers

James Cloos 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.