Skip to content

tvziet/market_place_api

Repository files navigation

This project for practicing API on Rails 7

Postgres Ruby Rails Postman Swagger Amazon AWS Dependabot

API documents

Start server, then access path: /api-docs.

How to setup

  • Copy .env.example to .env:

        cp .env.example .env
  • Create the database:

        rails db:create
  • Run migration:

        rails db:migrate
  • Run tests:

        rails test
  • Run linters:

        bundle exec rubocop

Description

Models

  • User
  • Order
  • Product
  • Image
  • Comment

Associations

The user will be able to place many orders, upload multiple products which can have many images or comments from another users.

Notes

fast_jsonapi gem

When we use this gem, we generate serializer, it will generate the folder serializers. We neet to load this folder in application.rb file:

config.eager_load_paths << Rails.root.join("serializers")

How to write custom validator methods

Read more here: Understanding Rails Custom Validations