Giter Site home page Giter Site logo

devenes / todos-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 234 KB

This API is a simple todo list. It is a RESTful API that allows you to create, read, update and delete todos.

License: Apache License 2.0

Go 95.21% Dockerfile 4.79%
api go golang restful-api docker dockerfile multi-stage

todos-api's Introduction

Todos Api

Todo List API

Go Build Go Build Tool Tool Tool Github top language Github language count Repository size License

About   |   Features   |   Technologies   |   Requirements   |   Starting   |   Containerization   |   License   |   Author

🎯 About

This API is a simple todo list. It is a RESTful API that allows you to create, read, update and delete todos.

✨ Features

Parameter Type Description
id string The id of the todo object
title string The title of the todo object

✔️ List todos
✔️ Get todo status
✔️ Create a new todo object
✔️ Delete a todo object

🚀 Technologies

The following tools were used in this project:

  • Go: The language used in this project
  • Docker: The containerization tool used in this project
  • GitHub: The source control tool used in this project
  • GitHub Actions: The continuous integration tool used in this project

✅ Requirements

Before starting 🏁, you need to have Git, Docker, and Go installed.

🏁 Starting

  • Clone the project
git clone https://github.com/devenes/todos-api
  • Go to the project directory:
cd todos-api
  • Run the following command to start the server:
go run main.go
  • You can also run the server in the background:
go run main.go &
  • Build the Docker image:
docker build -t devenes/todos-api:1 ./
  • You can also run the server in a Docker container:
docker run -p 8080:8080 -d devenes/todos-api:1
  • See the output:
docker build -t devenes/todos-api:1 ./ && docker run -p 8080:8080 -d devenes/todos-api:1 && explorer "http://localhost:8080/todos"
  • List todos with the following command:
curl http://localhost:8080/todos
  • Get the first todo with the following command:
curl http://localhost:8080/todos/1
  • Create a new todo with the following command:
curl -X POST -H 'content-type: application/json' --data '{"id": "4", "title": "Buy milk"}' http://localhost:8080/todos
  • Update the first todo with the following command:
curl -X POST -H 'content-type: application/json' --data '{"id": "1", "title": "Check the mailbox"}' http://localhost:8080/todos
  • Delete the first todo with the following command:
curl -X DELETE http://localhost:8080/todos/1
  • Get the second todo with the following command:
curl http://localhost:8080/todos/2
  • Stop and remove all Docker containers and images:
docker stop $(docker ps -aq) && docker rm $(docker ps -aq) && docker rmi $(docker images -q)

🐳 Multi-Stage Containerization

You can reduce the size of the Docker image from 301MB to 12MB by using multi-stage containerization. Check the Dockerfile to see how it works and look at the latest image created with alpine.

Docker image

📝 License

This project is under license from Apache 2.0. For more details, see the LICENSE file.

Made with ❤️ by devenes

 

⬆️ Back to top

todos-api's People

Contributors

devenes avatar

Watchers

 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.