/serverless-calendar

A calendar implementation in Serverless

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Serverless Calendar

A simple agenda REST API implementation with serverless framework and AWS provider.

The service is deployed here

Architecture

This is a sample REST API that perform CRUD operations on event resource. Data is stored in DynamoDB and the service is deployed on AWS.

Source code is written in TypeScript and it uses a functional approach with fp-ts and io-ts.

API

API endpoints are defined as a structure of io-ts types and used to validate request payload and response outputs.

Events

List

List all events filtered by given query params

Endpoint: GET /events

QueryParams: ListEventQueryParams

  • year: the selected year (optional)
  • week: the selected week (optional)

Output: Event[]

Get

Get event details

Endpoint: GET /events/{id}

PathParams: Id

  • id: the event id to retrieve

Output: Event

Create

Create an event

Endpoint: POST /events

Body: CreateEventData

  • title: event title
  • description: event description
  • address: event address
  • startDate: event start date
  • endDate: event end date

Output: Event

Edit

Modify the event

Endpoint: PUT /events/{id}

PathParams: Id

  • id: event id

Body: EditEventData

  • title: event title (optional)
  • description: event description (optional)
  • address: event address (optional)
  • startDate: event start date (optional)
  • endDate: event end date (optional)

Output: Event

Remove

Remove an event by id

Endpoint: DELETE /events/{id}

PathParams:

  • id: event id

Output: boolean

Development

Requirements

  • node

Install dependencies

npm i

Run locally

It will start an http server listening on http://localhost:3000/local

npm run dev