Skip to content

StasKuzichev/api-calendar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Calendar

Simple backend calendar Allows you to register new user, login using existing credentials and manage user events.

Requirements

  1. PostgreSQL Server v9.6+
  2. Create database ( default name: calendar-db )
  3. change config.js with your db connection options (defaults: username = postgres, password = 12345)
  4. go to project root directory run npm i
  5. in project root directory run db:init

Starting server

Go to the project root directory and run npm run dev

API Endpoints:

  • Create new User
    URL: /api/users
    Method: POST
    URL Params: None
    Body:

    • Required:
      • email[string]
      • password[string]
    • Optional:
      • name[string]
  • Refresh user access token
    URL: /api/users/token/refresh
    Method: POST
    URL Params: None
    Body:

    • Required:
      • accessToken[string]
      • refreshToken[string]
  • Login
    URL: /api/auth
    Method: POST
    URL Params: None
    Body:

    • Required:
      • email[string]
      • password[string]
  • Logout
    URL: /api/auth/logout
    Method: POST
    URL Params: None
    Body: None

  • Get all event types
    URL: /api/event-types
    Method: GET
    URL Params: None
    Body: None

  • Create new event
    URL: /api/events
    Method: POST
    URL Params: None
    Body:

    • Required:
      • type[integer]
      • startDate[format - 'YYYY-MM-DD HH:mm:ss']
    • Optional:
      • description[string]
      • endDate[format - 'YYYY-MM-DD HH:mm:ss']
  • Update event
    URL: /api/events/:id
    Method: PUT
    URL Params:

    • Required:
      • id[integer]

    Body:

    • Optional:
      • type[integer]
      • startDate[format - 'YYYY-MM-DD HH:mm:ss']
      • description
      • endDate[format - 'YYYY-MM-DD HH:mm:ss']
  • Delete event
    URL: /api/events/:id
    Method: DELETE
    URL Params:

    • Required:
      • id[integer]

    Body: None

  • Get events for today
    URL: /api/events/today/:offset?/:limit?
    Method: GET
    URL Params:

    • Optional:
      • offset[integer]
      • limit[integer]

    Body: None

  • Get events for current week
    URL: /api/events/week/:offset?/:limit?
    Method: GET
    URL Params:

    • Optional:
      • offset[integer]
      • limit[integer]

    Body: None

  • Get events for current month
    URL: /api/events/month/:offset?/:limit?
    Method: GET
    URL Params:

    • Optional:
      • offset[integer]
      • limit[integer]

    Body: None

  • Get events for current specific date
    URL: /api/events/date/:date/:offset?/:limit?
    Method: GET
    URL Params:

    • Required:
      • date[format - 'YYYY-MM-DD']
    • Optional:
      • offset[integer]
      • limit[integer]

    Body: None

    Auth:

    Bearer Token

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published