Git Product home page Git Product logo

golang-restful-api's Introduction

Cozy Take Home Test

Thanks for you interest in working with us here at Cozy! This is a small take home assessment to test your proficieancy with building backend web services.

Setup

You will need Go and Docker to run this project.

Here are the steps to get the project setup:

  • Run docker compose up
    • You can specify the -d flag if you want to start it in the background.
  • Run go run main.go seed
    • This will setup the DB schema and seed it with dummy data.
  • Run go run main.go
    • This will start up a basic RESTful server with a single endpoint.

We will be using Go with the Chi router and Postgres (Running in the Docker container) for this. The schema for the SQL DB can be found in schema.sql and a basic Chi setup can be found in api/routes.go.

assessment

I want you to create an RESTful API with the following endpoints:

  • /posts
    • This endpoint should return a paginated list of posts.
    • The return should be a list of objects with
      • post data
      • author data
      • the number of likes
    • It should take an optional user query param and if passed should return if that user liked the post.
  • /posts/:id
    • This endpoint should return a specific post by its ID.
    • The return should be an object with
      • post data
      • author data
      • the number of likes
    • It should take an optional user query param and if passed should return if that user liked the post.
  • /posts/:id/likes
    • This endpoint should return a paginated list of the users who liked a post.
    • The return should be a list of objects with
      • like date
      • user data
  • /users/:id
    • This endpoint should return a specific user by their ID.
    • The return should be an object with
      • user data
      • 5 latest posts by this user

Questions

If you have any questions or issues, please reach out to me at [email protected].

golang-restful-api's People

Contributors

shikhar97 avatar

Stargazers

 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.