restaurant-api

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2022 License: MIT Imports: 9 Imported by: 0

README

RESTAURANT API

Restaurant API created with GO
This API is a prototype (and implementation) of REST API for Restaurants created with Golang. The models of entities here are created based on the most simple data model that could be implemented. As this API is just a prototype, there are still many points that could be developed such as the data model, responded data structure, and performance. But I believe that this API prototype has covered all fundamentals of developing/building an API with Golang (with Gorilla/Mux and GORM).

To test the API, you may open this Postman documentation and explore all the test examples of each request.

Pre-requisites

  1. Understanding GO Fundamentals
    Tutorials Playlist

  2. Learn Gorilla/Mux and GORM
    Gorilla/Mux Documentation
    GORM Documentation

  3. Familiarize with MySQL
    Documentation

  4. Understanding REST API Concepts
    Explanation
    RESTful APIs in 100 Seconds

  5. Familiarize with Postman Documentation
    Postman Documentation Tutorial

Setup

1. Set the .env file with credentials needed.
# Port of the Server
PORT=<PORT>

# Database Information
DB_URL=<DB_URL>

# JWT Information
JWT_KEY=<JWT_KEY>
2. Create MySQL Database
Local
# Login to MySQL User
# You may use root as the user
mysql -u <MySQL User> -p

# Enter password on given prompt
Password: <MySQL Password>

# Create Database
CREATE DATABSE <MySQL Database Name>; 
Cloud

Create Free MySQL Database Online

3. Run Modules Installation
# Install all modules used in the project
go get ./...
4. Run API
Run (without build)
go run .\main.go
Build (convert to .exe format)
go build .\main.go

.\main.exe
5. Request Testing

Published Restaurant API Documentation
Json of API Documentation

Contributor

  • Vincent Pradipta (xhfmvls)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL