Skip to content

A Beginner friendly repo through which open-source people can understand CRUD operations in Golang

Notifications You must be signed in to change notification settings

EuclidStellar/CRUD-API-Go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Golang CRUD Operations with Hardcoded Data

This repository demonstrates basic CRUD (Create, Read, Update, Delete) operations in Golang using hardcoded data.
It provides a simple example to understand how to implement these operations in a Golang application.

## Project Structure

- `main.go`: The main Golang file containing the CRUD operations.
- `README.md`: Documentation explaining the purpose and usage of the project.

## Prerequisites

Make sure you have Golang installed on your machine. If not, follow the instructions on the [official Golang website](https://golang.org/doc/install).

Getting Started

  1. Clone the repository:

    git clone https://github.com/EuclidStellar/CRUD-API-Go/
  2. Navigate to the project folder:

    cd CRUD-API-Go
  3. Run the application:

    go run main.go
  4. Open your web browser and access the following endpoints:

Create a new movie

curl -X POST -H "Content-Type: application/json" -d '{"id": "6", "title": "New Movie", "year": "2023", "director": {"firstname": "John", "lastname": "Doe", "age": 40}}' http://localhost:8000/movies

Update a movie

curl -X PUT -H "Content-Type: application/json" -d '{"id": "6", "title": "Updated Movie", "year": "2023", "director": {"firstname": "John", "lastname": "Doe", "age": 40}}' http://localhost:8000/movies/6

Delete a movie

curl -X DELETE http://localhost:8000/movies/6

Running Locally

To run the project locally, make sure you have Golang installed. Follow these steps:

  1. Clone the repository:

    git clone https://github.com/EuclidStellar/CRUD-API-Go/
  2. Navigate to the project folder:

    cd CRUD-API-Go
  3. Run the application:

    go run main.go
  4. Access the endpoints as described in the "Getting Started" section.

Contributions

Contributions are welcome! If you have improvements, suggestions, or bug fixes, feel free to open an issue or create a pull request.

License

This project is licensed under the MIT License.

Author


Customize the content further based on your repository's specifics.

About

A Beginner friendly repo through which open-source people can understand CRUD operations in Golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages