Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Full-Stack Web Development with TypeScript 5
  • Table Of Contents Toc
Full-Stack Web Development with TypeScript 5

Full-Stack Web Development with TypeScript 5

By : Mykyta Chernenko
4.3 (3)
close
close
Full-Stack Web Development with TypeScript 5

Full-Stack Web Development with TypeScript 5

4.3 (3)
By: Mykyta Chernenko

Overview of this book

This book takes you on a journey with TypeScript 5, introducing its nuances and advantages over traditional JavaScript, explaining TypeScript basics, and highlighting the syntax, typing, generics, classes, and interfaces. Expert advice will help you build your understanding of TypeScript's role in modern web applications. You'll gain hands-on experience with the tools required to write full-stack web applications end to end, beginning with setting up the Bun environment for backend development. This book also explores server-side functionality such as authentication, routing, and database integration with PostgreSQL. The second part of the book focuses on the integration of the OpenAI API, demonstrating the use of the GPT API for different use cases. The final part covers frontend development using Svelte, guiding you through UI design, state management, and performance optimization. Each chapter has real-world examples and comparisons to other technologies, providing you with a comprehensive understanding of full-stack development. By the end of this book, you'll have learned how to build modern web applications using TypeScript 5 and confidently tackle full-stack development challenges.
Table of Contents (23 chapters)
close
close
Lock Free Chapter
1
Part 1: Introduction to TypeScript
4
Part 2: Backend Development with Bun and TypeScript
9
Part 3: Integrating PostgreSQL for Data Management
13
Part 4: AI Integration with OpenAI API
16
Part 5: Frontend Development with Svelte

Implementing chat controllers

Now, we have come to the implementation of the main functionality for our application that we are going to use to provide the core features of our app with the help of controllers.

For our app, we will need to support the following functionality:

  • Create a new chat: Users can start a new chat on some topic in our app
  • Get all chats: Users can see all the created chats in a list on the menu
  • Get a specific chat: Users can enter a specific chat and the details
  • List of chat messages: Users can retrieve all the messages in a chat
  • Create a new message in a chat: Users can send new messages in a chat

Let’s implement all this functionality in our endpoints.

Implementing the endpoints

In this piece of code, we will create our chat app that is going to have endpoints for chat and message creation as well as their retrieval:

src/controllers/chat.ts

import { Hono } from "hono";
import type { ContextVariables...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Full-Stack Web Development with TypeScript 5
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon