Skip to content

About

Simple Guestbook API

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Simple Guestbook

Simple Guestbook API using Gorilla Mux, GORM, and MySQL databases. Simple Go testing, swagger documentation, and client example included.

Check file static/docs/index.html or redoc.html to view API documentation.

Check file static/index.html for example.

Features :

  • Pretty simple create & read the post from the database for the guestbook

How to install

  1. Clone this repository

  2. Create the messages table

CREATE TABLE IF NOT EXISTS messages (
    id int(5) NOT NULL,
    name varchar(50) NOT NULL,
    message varchar(160) NOT NULL,
    contact varchar(50) NOT NULL,
    created_at datetime NOT NULL
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

ALTER TABLE `messages` ADD PRIMARY KEY (`id`);

ALTER TABLE `messages` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT;
  1. Create .env files, check env.example for example.

  2. Fix package import

    go get
  3. Test the code

    go test -v
  4. Run the code

    go run .
  5. Build the application

    go build .

TODO

  • Add account system to create, update, and delete the post message using JWT auth
  • Arrange file structure.
  • Generate the OpenApi document automatically. Currently, I write it manually on swagger.yaml file
  • Fix user interfaces for client example, make it more beautiful
  • Form validation

LICENSE

MIT

About

Simple Guestbook API

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages