Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/franconix95/be_clockwork

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/franconix95/be_clockwork

  • v0.0.0-20201026115527-cb8a5dc09a16
  • Source
  • Go
  • Socket score

Version published
Created
Source

Go Todo REST API Example

A RESTful API example for simple todo application with Go

It is a just simple tutorial or example for making simple RESTful API with Go using gorilla/mux (A nice mux library) and gorm (An ORM for Go)

Installation & Run

# Download this project
go get github.com/Franconix95/be_clockwork

Before running API server, you should set the database config with yours or set the your database config with my values on config.go

func GetConfig() *Config {
	return &Config{
		DB: &DBConfig{
			Dialect:  "mysql",
			Username: "guest",
			Password: "Guest0000!",
			Name:     "todoapp",
			Charset:  "utf8",
		},
	}
}
# Build and Run
cd go-todo-rest-api-example
go build
./go-todo-rest-api-example

# API Endpoint : http://127.0.0.1:3000

Structure

├── app
│   ├── app.go
│   ├── handler          // Our API core handlers
│   │   ├── common.go    // Common response functions
│   │   ├── projects.go  // APIs for Project model
│   │   └── tasks.go     // APIs for Task model
│   └── model
│       └── model.go     // Models for our application
├── config
│   └── config.go        // Configuration
└── main.go

API

/projects
  • GET : Get all projects
  • POST : Create a new project
/projects/:title
  • GET : Get a project
  • PUT : Update a project
  • DELETE : Delete a project
/projects/:title/archive
  • PUT : Archive a project
  • DELETE : Restore a project
/projects/:title/tasks
  • GET : Get all tasks of a project
  • POST : Create a new task in a project
/projects/:title/tasks/:id
  • GET : Get a task of a project
  • PUT : Update a task of a project
  • DELETE : Delete a task of a project
/projects/:title/tasks/:id/complete
  • PUT : Complete a task of a project
  • DELETE : Undo a task of a project

Todo

  • Support basic REST APIs.
  • Support Authentication with user for securing the APIs.
  • Make convenient wrappers for creating API handlers.
  • Write the tests for all APIs.
  • Organize the code with packages
  • Make docs with GoDoc
  • Building a deployment process

FAQs

Package last updated on 26 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc