Recipeapi

This project is a step by step guide on how to create a simple API using Go programming language. The purpose of the project is to demonstrate to new comers the language features, concepts and how to create a fully tested, readable and maintainable project.
Alternatives To Recipeapi
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nestjs Realworld Example App2,489
a month ago42TypeScript
Exemplary real world backend API built with NestJS + TypeORM / Prisma
Spring Security React Ant Design Polls App1,617
a month ago45Java
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Nacos Docker1,087
6 days ago49Shell
This project contains a Docker image meant to facilitate the deployment of Nacos .
Spring Boot Spring Security Jwt Authentication697
6 months ago10Java
Spring Boot + Security: Token Based Authentication example with JWT, Authorization, Spring Data & MySQL
Apevolo Api421
9 days ago1apache-2.0C#
.Net 6.0 、SqlSugar、Vue、RBAC、前后端分离的开箱即用的企业级中后台权限管理系统
Laconia320
2 years ago4mitPHP
🏺 ‎ A minimalist MVC framework.
Node Express Passport Mysql317
3 years ago9JavaScript
Login Express + Passport + MySQL
Mysql30519132 months ago16September 15, 202213mitPHP
Async MySQL database client for ReactPHP.
Express Rest Api Boilerplate274
4 years ago11mitJavaScript
Express REST API with JWT Authentication and support for sqlite, mysql, and postgresql
Docker Ejabberd248
2 years ago32mitShell
Dockerfile for Ejabberd server
Alternatives To Recipeapi
Select To Compare


Alternative Project Comparisons
Readme

Test GolangCI codecov Go Report Card

Puppy API rip off (exercise)

Simple api that serves recipes for puppies. This project is a step by step guide on how to create a simple api using Go programming language. The purpose of the project is to demonstrate to new comers the language basic features and concepts.

The exercise is based on recipepuppy free api. All the puppy recipes used were also retrieved from there.

Project is divided into nine steps, each step has its own branch.

  • 00-CI
  • 01-Server
  • 02-Configuration
  • 03-Logging
  • 04-Handlers
  • 05-Routes
  • 06-Database
  • 07-Handler-real-data
  • 08-Middleware
  • 09-Authentication
  • 10-Swagger

Prerequisites

  • Go
  • Docker

Starting database container

docker-compose up -d

Setup databases

Set up required databases. At each execution recreates database and re imports data.

make db

Set up/reset only dev-db

make db-dev

Set up/reset only test-db

make db-test

Configuration

Most of the project values can be configured by editing config.yaml, config file is located under the project root folder.

You can use the following config format types

  • JSON
  • TOML
  • YAML
  • HCL
  • envfile

You can override any config value by using environmental values, for example to override token.ttl you need to set an environmental variable with key RECIPE_TOKEN_TTL

Project is using Viper config a complete configuration solution for Go applications

Running tests

make test

Running project

make run

Building project

make build

Running linter

make lint

if you are behind a corporate firewall using a custom certificate use

make lint-insecure

Project is using golang lint linter

Usage examples

Get recipe

http://127.0.0.1:8080/api/recipe/1 [GET]

Get Recipes

http://127.0.0.1:8080/api/recipes?ingredient=onions&ingredient=garlic&term=omelet&page=1 [GET]

User Sign up

http://127.0.0.1:8080/api/user/signup [POST]

{
    "email":"[email protected]",
    "username":"username2",
    "password":"password",
    "repeatPassword":"password",
    "fullName":"test user"
}

User Sign in

http://127.0.0.1:8080/api/user/signin [POST][body]
{
    "username": "username1",
    "password": "password"
}

User Profile

http://127.0.0.1:8080/api/user [GET]

Postman

For your convenience Postman collection/environment files are available at

api/Recipes.postman_collection.json
api/Recipes.postman_environment.json

Available Parameters explanation:

  • ingredient : list of ingredients
  • term : text search in titles
  • page : page number

Swagger Docs

You can view swagger docs after running the app here http://127.0.0.1:8080/swagger/index.html

Project is using swaggo/swag to generate/update swagger docs you can install the cli using the following command

go get github.com/swaggo/swag/cmd/swag

Update swagger docs

swag init --dir cmd/api --output api/swagger

or

make swagger

Authors

  • George Lavdanis - Initial work - georlav

License

This project is licensed under the MIT License - see the LICENSE file for details

Popular Mysql Projects
Popular Authentication Projects
Popular Data Storage Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Go
Golang
Mysql
Language
Authentication
Tutorial
Api Rest
Swagger
Programming Language