Skip to content

Latest commit

 

History

History
55 lines (45 loc) · 2 KB

README.md

File metadata and controls

55 lines (45 loc) · 2 KB

🏁 tdd_node_auth

This repository contains a basic REST API with a simple jwt login endpoint and middleware to check authentication but implemented using concepts of TDD

📚 Technologies

  • Nodejs
  • Express
  • PostgreSQL
  • SQLite (for tests)
  • Docker
  • SequelizeORM
  • Jest

📃 Installing dependencies

To manage the dependencies, this project uses preferably yarn, but you can feel free to use npm instead. If you want to use yarn but don't have it yet, check out the installation guide from official documentation

With yarn installed open your favorite shell in the root folder of this project and then run:

yarn

Or if you choose to use npm, run:

npm i

📡 Running Application (Development)

Running the application in development mode allows it to take advantage of nodemon to restart the server for every change, to start the server in development mode, simply run:

yarn dev

Or if you choose to use npm, run:

npm run dev

🎬 Running Tests

To test the application, the environment is changed in such a way that the DB becomes SQLite instead of PostgreSQL to not affect the possible production database.

All the migrations are executed before the tests and undone after the tests (see pretest and posttest scripts respectively in the package.json file for more info)

Also, the database is truncated before every test in order to avoid any bias on tests

yarn test

Or if you choose to use npm, run:

npm run test

🔭 Future Plannings

  • Change the implementation to Typescript
  • Create a deployment guide

💜 Acknowledgment

🚀@rocketseat-content for sharing the content that allowed me to practice and learn about TDD, check out the video (in portuguese) or the repo