git clone
npm i
npm start
looking at the concept of separating our Api from any framework we may choose.
createRouter(router);
could take in any router.
For example we currently use express so we pass the const router = Router();
into the createRouter
function.
This function also houses the creation of our api and returns it to the framework to use via helper functions.
This pattern also enables easy unit testing of each route.
The repo.ts
files is where we create our api return values.
ts node dev, express, ts-jest
- api/signin
- api/verify
- api/products
- /api
basic tests for routes using superTest