baselrabia / book-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Golang assignment ๐Ÿ’ป

This assignment will form the basis for the job interview. You will show-case your implementation and talk about the choices you made and obstacles if you encountered any.

Prequisites โœ”๏ธ

  1. Git
  2. Golang
  3. Docker (optional)

Assignment ๐Ÿ“

Fork this repository and commit your code to your own repository.

  1. Create a simple Golang application that will serve a RESTful API with a resource of your choice (pets, books, memes, etc). The endpoints should support Create, Read, Update and Delete operations.
  2. The data should be persisted in a database like SQLite, MySQL, PostgreSQL, etc.

If you are stuck or want some inspiration see the tips below.

Optionals

  1. Add tests for you REST API.
  2. Create a dockerfile for your application.

Tips ๐Ÿงž

Application example

Endpoints:

# Get all pets
GET /pets

# Get a specific pet
GET /pets/:id

# Create a pet
POST /pets

# Update a pet
PUT /pets/:id

# Delete a pet
DELETE /pets/:id

Model:

{
    "id": 1,
    "name": "Fluffy",
    "age": 3,
    "breed": "cat"
}

Database

This package can be used to connect to a local SQLite database:

If you want an ORM (Object Relational Mapping) library, you can use GORM:

REST API

For creating a HTTP server, you can use echo:

REST API testing

Documentation for testing echo endpoints:

About


Languages

Language:Go 95.0%Language:Dockerfile 5.0%