Socket
Socket
Sign inDemoInstall

github.com/xhfmvls/restaurant-api

Package Overview
Dependencies
8
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/xhfmvls/restaurant-api


Version published

Readme

Source

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)

FAQs

Last updated on 02 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc