Description | Requirements | Technologies | Usage
This project was developed with the goal of exploring and learning how to use the Fastify library for creating APIs with Node.js, as well as getting familiar with Knex as a query builder to interact with databases. I also took the opportunity to practice and solidify my knowledge in testing.
- The user must be able to create a new transaction;
- The user must be able to get a summary of their account;
- The user must be able to list all transactions that have occurred;
- The user must be able to view a single transaction.
- The transaction can be of the credit type, which will add to the total amount, or debit, which will subtract;
- It must be possible to identify the user among the requests;
- The user can only view transactions they have created.
- Unit: unit of your application;
- Integration: communication between two or more units;
- E2E: simulate a user operating in our application.
Test pyramid: E2E does not depend on any technology, nor on architecture.
- Nodejs
- Typescript
- Fastify
- Knex
- Sqlite3
- Zod
- Vitest
- Supertest
- Eslint
- @rockeseat/eslint-config
- Prettier
You can clone it on your pc using the command:
git clone https://github.com/Lissone/node-fastify-knex.git
cd node-fastify-knex
You need to run a knex script command to run all current migrations:
npm run knex -- migrate:latest
About more knex commands:
# List knex help
npm run knex -- -help
# Create a migration
npm run knex -- migrate:make <name_migration>
# .\.env
NODE_ENV=development
DATABASE_URL="./db/app.db"
yarn
#or
npm install
yarn start:dev
#or
npm run start:dev
Distributed under the MIT License. See LICENSE
for more information.