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)
Get
Get event details
Endpoint: GET /events/{id}
- id: the event id to retrieve
Create
Create an event
Endpoint: POST /events
- title: event title
- description: event description
- address: event address
- startDate: event start date
- endDate: event end date
Edit
Modify the event
Endpoint: PUT /events/{id}
- id: event id
- title: event title (optional)
- description: event description (optional)
- address: event address (optional)
- startDate: event start date (optional)
- endDate: event end date (optional)
Remove
Remove an event by id
Endpoint: DELETE /events/{id}
- 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