GithubHelp home page GithubHelp logo

nronzel / simpletaskapi Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 17 KB

Simple Task/To-Do management API. Supports CRUD operations for tasks.

License: MIT License

Dockerfile 16.23% Go 83.77%
api task-management todo

simpletaskapi's Introduction

Simple Task API

Overview

Simple RESTful CRUD API designed for front-end developers who are learning how to build todo-list applications and work with an API. Offers a straightforward task management system where users can create, retrieve, update, and delete tasks. Each task is timestamped with createdAt and updatedAt fields to track when tasks are added or modified.

This basic version does not utilize any actual database, instead just storing the tasks in memory. There is also no authentication. I will be creating alternate versions that are more advanced with authentication and a database.

Please don't try to use this for a production application! This is meant purely for learning purposes and to be used locally.

Getting Started

Prerequisites

  • Go version 1.22
  • Dependencies (automatically installed with go mod tidy)
    • Chi
    • Zerolog
  • Docker (optional)
  • Basic knowledge of RESTful principles and HTTP requests

Installation

  1. Clone this repository or download the source code.
git clone github.com/nronzel/simpleTaskApi
  1. Navigate to the project directory.
cd simpleTaskApi
  1. Install the dependencies:
go mod tidy
  1. Run the server from your terminal:
go run .

Docker

If you have Docker installed, you can run the API in a container.

The latest versions of Docker Desktop come with docker compose pre-installed.

The easiest way to run the API in a container is to use docker compose. This will build the image and run the container in the background.

docker compose up --build -d

Or you can build the image and run the container manually.

docker build -t taskapi .
docker run -p 9090:9090 taskapi

You can navigate to http://localhost:9090/ in your browser to make sure it is working.

Accessing the API Documentation

This API is documented using Swagger. Once the server is running, you can access the Swagger UI to test the API endpoints directly through your browser:

http://localhost:9090/swagger/

Endpoints

Below is a brief overview of the API endpoints. For detailed request and response formats, refer to the Swagger documentation.

  • List All Tasks

    • GET /tasks
    • Retrieves all tasks.
  • Get a Task by ID

    • GET /tasks/{taskID}
    • Fetches a single task by its ID.
  • Create a New Task

    • POST /tasks
    • Adds a new task. The request body should include the task field.
  • Update a Task

    • PUT /tasks/{taskID}
    • Modifies an existing task. The request body should contain the updated task field.
  • Delete a Task

    • DELETE /tasks/{taskID}
    • Removes a task by its ID.

License

This project is open source and available under the MIT License.

Features/Issues

If you have any feature requests or find any issues, please open an issue.

Contributing

Contributions are welcome! Please open an issue before submitting a pull request.

simpletaskapi's People

Contributors

nronzel 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.