Thanks to visit codestin.com
Credit goes to github.com

Skip to content
View kalisamu's full-sized avatar
  • T.A.G.S.
  • Massachusetts, USA
  • 03:48 (UTC -12:00)

Block or report kalisamu

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
kalisamu/README.md

Node.js API: CRUD operations with Pagination, Filtering, Grouping and Sorting capabilities.

Node.js REST API with CRUD and Aggregation operations including Pagination, Filtering, Grouping, Sorting and Partial Text Search.

This Branch

CRUD Operations (Event)

Other Branch

Node.js Authentication API with Email Verification

Node.js Authentication API with No Email Verification

Tutorial

Tutorial available here

API Documentation

Request parameters

  • q -  Keywords or phrases to search for in the event name - Performs Partial Text Search.
  • date - Retireve all events for the specified date. Format: YYYY-MM-DD (e.g. 2020-01-08
  • sort_order - The order to sort the events in. Possible options: asc, desc. Default: asc
  • limit (int)- The number of results to return per page. Default: 5
  • page (int) - Use to page through the results.

Response object

  • totalResults(int) - The total number of results available for the request.
  • limit(int) - The limit used
  • page(int) - The current page number
  • totalPages(int) - The total number of pages available
  • hasPrevPage(boolean) - Indicates if there is a previous page
  • hasPrevPage(boolean) - Indicates if there is a next page
  • prevPage(int) - The previous page in the resultset
  • nextPage(int) - The next page in the resultset
  • events (array)- The events grouped by date. Contains JSON objects with an _id and data key.

events

  • _id(date) - The event date
  • data (array)- The events for this date. Contains JSON objects
data
  • userId - The identifier id for the user that created the event.
  • name(string) - The name of the event
  • location(string) - The location of the
  • address(string) - The location of the event
  • start_date(string) - The start date and time of the event
  • end_date (string) - The end date and time of the event
  • description(string) - A description or snippet from the article.
  • image (string) - The URL to a image for the event.
  • createdAt (string) - The date and time that the event was added.

Testing

Use Postman to test.

Seed Database

Populate the database with some fake data by accessing the seed endpoint. /api/event/seed . Make sure you have logged in as this endpoint requires an authentication token.

Create a GET request to /api/event/seed

Seed Database


Pagination and Sorting

Create GET requests

  1. Get all events [default limit is 5] http://localhost:3000/api/event

  2. Page through the results http://localhost:3000/api/event?page=2

  3. Get all events in descending order http://localhost:3000/api/event?sort_order=desc

  4. Get all events with a limit of 10 http://localhost:3000/api/event?limit=10

Pagination and Sorting


Filtering and Grouping

Create GET requests

  1. Search for an event
    http://localhost:3000/api/event?q=[search_text]

  2. Get all the events for a particular date - Grouped
    http://localhost:3000/api/event?date=2020-07-07

  3. Get all the events for a particular date - Without Grouping
    http://localhost:3000/api/event?date=2020-07-07&group=0

  4. Get all the events without Grouping
    http://localhost:3000/api/event?group=false

Filtering and Grouping


Create, Read and Update

  1. Create an event [POST]
    http://localhost:3000/api/event

  2. Read an event [GET]
    http://localhost:3000/api/event

  3. Update the event [PUT]
    http://localhost:3000/api/event


Attempt to update an event that doesn't belong to you. Should receive an error message. { "message": "Event does not exist" }

Create, Read and Update


Popular repositories Loading

  1. kalisamu kalisamu Public

    JavaScript

  2. Amazon_Rose_Forest_01 Amazon_Rose_Forest_01 Public

    Amazon Rose Forest is the foundational codebase of FLOSSI0ULLK: a decentralized, agent-centric ecosystem for infinite overflowing unconditional love, light, and knowledge. It integrates Holochain, …

    HTML

  3. parakeet parakeet Public

  4. snapdir snapdir Public

    Audit and distribute authenticated directory snapshots.

  5. faryon faryon Public

    Forked from PauleClark/faryon

    a tool which converts eagle schematic to xilinx ucf constraint file

    Vue

  6. goodtft6 goodtft6 Public

    Forked from Adraylis/goodtft6

    2.4" 2.8"3.2" 3.5" 5.0" 7.0" TFT LCD driver for the Raspberry PI 3B+/A/A+/B/B+/PI2/ PI3/ZERO/ZERO W

    JavaScript