Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daern91/taxi-bid
https://github.com/daern91/taxi-bid
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/daern91/taxi-bid
- Owner: daern91
- Created: 2024-02-12T12:06:39.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-13T18:35:29.000Z (9 months ago)
- Last Synced: 2024-02-14T18:16:58.561Z (9 months ago)
- Language: TypeScript
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Summary
Tiny TypeScript/nodejs backend taxi-booking app using Postgres as db and express as server framework.
The routes, spec, API-client, etc, are all generated with [tsoa](https://github.com/lukeautry/tsoa).
### Description
One problem I've seen happening over and over again in the industry is that we get behind with chore work such as updating Openapi specs and SDKs. I wanted to find a solution, and this repo is an example that fixes it by using a code-first approach that generates routes, validators, client SDK, and API-spec (swagger).
The idea is that we should be able to code our types, and set up the routes/handlers we want, and everything else should be updated from there. I found that `tsoa` handles routes, validators, and specs nicely with express and [https://github.com/ferdikoomen/openapi-typescript-codegen](openapi-typescript-codegen) delivered a workable SDK.
Please have a look inside the backend folder to see the structure, then the magic happens with the `generate` script defined in the be:s `package.json`.
Also note that you need to cd into the backend folder and run both `npm install` and `npm run generate` there in order to build the be routes and the client.
### Setup steps
1. Add local db folder `mkdir -p .postgres/data`
2. `cd` into the backend folder and run `npm install` followed by `npm run generate`. This will build routes, api-spec, and api-client for the script to use.
3. Run `docker compose up` to start services and populate DB.
4. `cd` into the scripts folder, run `npm install` followed by `npm start` to verify that all endpoints are working.
5. Script tests should pass