Skip to content

DevC0301/notes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Notes API (Sanctum + Role-based)

Requirements

  • PHP 8.2+
  • Composer
  • Laravel 11
  • MySQL or other supported DB

Installation

  1. Clone / extract project
  2. Install dependencies: composer install
  3. Copy env: cp .env.example .env Configure DB settings in .env
  4. Generate key: php artisan key:generate
  5. Migrate & seed admin: php artisan migrate php artisan db:seed --class=AdminUserSeeder
  6. Install Sanctum (if not installed): composer require laravel/sanctum php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider" php artisan migrate

Admin credentials (created by seeder)

Change this in production.

API Endpoints

Public:

  • POST /api/register
    • body: name, email, password, password_confirmation
  • POST /api/login
    • body: email, password

Protected (must send Authorization: Bearer {token}):

  • POST /api/logout
  • POST /api/notes — create note
    • body: title (required), content
  • GET /api/notes — list notes
    • Admin: sees all notes
    • User: sees only own notes
    • optional query params:
      • search=keyword — search in title/content
      • per_page=10 — return paginated response
  • DELETE /api/notes/{id} — delete (owner or admin)
  • PATCH /api/notes/{id} — update (owner or admin)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages