Categorygithub.com/timur-danilchenko/go-nodes
module
0.0.0-20240706092751-246bf29ecc62
Repository: https://github.com/timur-danilchenko/go-nodes.git
Documentation: pkg.go.dev

# README

Golang REST API Project: Notes

This is a simple REST API project built with Go, using the Gorilla Mux router and PostgreSQL as the database.

Getting Started

To get started with this project, first clone the repository to your local machine:

git clone https://github.com/timur-danilchenko/notes.git

Prerequisites

Before you can run this project, you will need to have Go and PostgreSQL installed on your machine.

Installing

To install the project dependencies, run the following command:

make setup

This will install all required dependencies and create the necessary database and table.

Running

To start the server, run the following command:

make start

This will start the server on port 8080.

Usage

  1. Start the server by running make start. This will start the server at http://localhost:8080.

  2. Explore the REST API using your preferred tool, such as curl, httpie, or a REST client like Postman. The available endpoints are:

MethodEndpointDescription
GET/notesRetrieve all notes
GET/notes/{id}Retrieve a specific note by ID
POST/notesCreate a new note
PUT/notes/{id}Update an existing note by ID
DELETE/notes/{id}Delete an existing note by ID
  1. The request and response payloads for each endpoint are described in the openapi.yaml file, which is an OpenAPI specification file. You can use tools like Swagger UI or ReDoc to explore the API documentation visually.

  2. The server can be configured by setting the following environment variables:

VariableDefault valueDescription
DB_USERpostgresPostgreSQL user
DB_PASSpostgresPostgreSQL password
DB_HOSTlocalhostPostgreSQL host
DB_PORT5432PostgreSQL port
DB_NAMEnotesPostgreSQL database name
  1. Stop the server by pressing Ctrl+C or sending a SIGINT signal.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author