Code Monkey home page Code Monkey logo

api_quasard's Introduction

Simple Symfony API

This is a basis API App using Symfony. Three entities and their endpoints are used: users, notes and categories.

How to run the app on development

It's necessary to install the Symfony CLI before to run the local server.

Run command:

cd my-project/
symfony server:start -d

Add -d to run the server in background and continue using the console.

To stop the server:

symfony server:stop

Watch last server log (only when the server is running):

symfony server:log

To access to the application:

http://localhost:8000

NOTE: restart the server after every composer.json modification.

More details on: https://symfony.com/doc/current/setup/symfony_server.html


ER schema

|-------| 1   N |-------| N   N |------------|
| users |-------| notes |-------| categories |
|-------|       |-------|       |------------|
  • The user can have notes.
  • Each note belongs to an user.
  • Each note has one or more categories and each category can have many notes.

BD diagram

Create DB tables

Use the files from "database/sql" to create the BD tables in this order:

  • create-tables.sql
  • test-inserts.sql
  • constraint-tables.sql

NOTE: the inserts are optional, use to check on first place some GET endpoints. NOTE: the provided SQL was tested on MySQL 8.0.36 on Ubuntu.


API routes

The available API routes are:

DELETE | [domain]/api/v1/users/[id]
GET    | [domain]/api/v1/users
GET    | [domain]/api/v1/users/[id]/notes
GET    | [domain]/api/v1/users/[id]/old-notes
GET    | [domain]/api/v1/users/[id]
POST   | [domain]/api/v1/users
PUT    | [domain]/api/v1/users

DELETE | [domain]/api/v1/notes/[id]/user/[user_id]
GET    | [domain]/api/v1/notes/[id]
POST   | [domain]/api/v1/notes
PUT    | [domain]/api/v1/notes/remove-category
PUT    | [domain]/api/v1/notes/set-category
PUT    | [domain]/api/v1/notes

DELETE | [domain]/api/v1/categories/[id]
GET    | [domain]/api/v1/categories
GET    | [domain]/api/v1/categories/[id]
POST   | [domain]/api/v1/categories
PUT    | [domain]/api/v1/categories

NOTE: routes on the controllers as attributes.


App Directories

src/
  |-- Controller/
  |     |-- api/
  |
  |-- Exceptions/
  |
  |-- Repository/
  |     |-- Data/
  |     |-- Traits/
  |
  |-- Service/
  |     |-- Common/
  |     |
  |     |-- Repository/
  |           |-- Category/
  |           |-- CategoryNote/
  |           |-- Common/
  |           |-- Note/
  |           |-- User/
  |
  |-- Util/
        |-- Helpers/
        |     |-- Common/
        |
        |-- Interfaces/

@author: Moisés Alcocer, 2024 @license: Apache 2.0 @repo: https://github.com/oricis/api_quasard

api_quasard's People

Contributors

oricis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.