a speci fi c need by con fi guring and customising the contained application building blocks using the provided development tools” HOW DOES BASEJMP SOLVE THIS
LOGIC Functionality of the application API’s How back-end functionality is exposed to front-end and other applications Web UI Front-end of the application
Data Blocks (Database, Table, Columns) 2. BUSINESS LOGIC Implement the Business Logic using either SQLAPI, Lambda, Containers, Hosting and Authentication Pool 3. API’s Configure Domain, Path and Access Rule Blocks to access the Business Logic 4. Web UI Build and implement the front-end using the client blocks
the application Determine the database schema and configure the Database Blocks - Database, Table, Columns Determine the Business logic requirements and configure SQLAPI, Lambda, Containers, Hosting and Authentication Determine access mechanisms and configure Domain, Path, and Access Rules Design and implement UI using the client blocks
todo items) Requirements A Web based application to manage the list of todos Each todo item has a id, title, description and completion status Ability to view list of todo items Ability to add add a new todo item Ability to delete a todo item Ability to mark a todo item as completed
todos with each todo item having attributes of id, title and description. We create the following • Database: Need a transaction database called main • Table: A table in the main database called todos • Columns in the todos table • Id which is a string • Title which is a string • Description which is a string DATABSE-TABLE- COLUMN
business logic as SQL API’s • Get a list of all todo items • SQLAPI called get_all_todos • select * from todos • Delete a todo item • SQLAPI called delete_todo • delete from todos where id='{{id}}' • Mark a todo item as completed • SQLAPI called mark_completed • update todos set status='closed' where id=‘{{id}}' SQL API
business logic as lambda functions • Inserting a todo item • This lambda takes id, title and description as HTTP POST JSON and writes this into the database. • The code for this lambda is generated with the following prompt The handler is called process_post that takes as arguments request_header which is a object and request_body which is a string The handler does the following 1. Parse the request body and store in a object 2. Create a SQL command that inserts into the todos table in main database the columns id, title description and status with values of the same name from the request body 3. Execute the SQL command 4. Create a response header object with a status of 200 and headers object as empty object and set the response header. 5. Create a response body object with a boolean as success 6. If the sql execution is a success set the boolean in response body as true else set it as false 7. Set the response body by converting the response body object as string
the application in future. This would need for a mechanism for a user to login fi rst prior to being able to access the API’s. So we create the following • Authentication Block : main • Authentication Service : main_login that enables a login service for the above authentication block
created so far by creating the following • Domain: name main • Paths (Provide appropriate names) • /public_api/get_all_todos_sa that exposes the SQLAPI get_all_todos at this path • /public_api/mark_completed that exposes the SQLAPI mark_completed at this path • /public_api/delete_todo that exposes the SQLAPI delete_todo at this path • /public_api/insert_todo that exposes the Lambda insert_todo at this path • /public_auth/login that exposes the Authentication service login DOMAIN-PATH-PATHGROUP
public. No access rule to be speci fi ed for now. Try blocking a public_api and then trying to Access it without logging-in Login using the login path and use the obtained token to access the api.
UI Components Local State Event Handler Thunks Events Dispatch Thunks Thunks call API’s and dispatch actions Reducers modify state based on action State changes causes UI render
Application: web • Component: Home with route as / • Reducer: todo_reduced that handles action called set_todos • Thunk: • get_todos that fetches todos from the /get_todos_sa path and dispatches the set_todos action • insert_todos that inserts a new todo by calling the /insert_todo endpoint and dispatched the get_todos thunk to refresh the list of todos FRONT-END