In order to provide the data that we have stored in our database to our application, we will create a set of REST endpoints in our Express server that will connect to our database, execute a SQL query, and return data as JSON objects. In order to work with an Sqlite3 database, we will use the sqlite3 node library, which can be installed as follows:
npm install sqlite3 npm install @types/sqlite3 --saveDev
In order to serve data to our application, we will create a new Express handler in the express/routes directory named dataRoutes.ts as follows:
import * as express from 'express'; import { serverLog } from '../main'; var router = express.Router(); router.get(`/boards`, async (req: any, res: any, next: any) => { serverLog(`GET ...