Skip to content
/ node-tdd-jest Public template

basic node project using TDD with Jest, server in Express and tools to lint the code

Notifications You must be signed in to change notification settings

sandro-dev/node-tdd-jest

Repository files navigation

TDD Jest Node Node with TDD and Jest



GitHub repo size GitHub language count GitHub top language GitHub last commit



Indíce

📖 Sobre

Um projeto base que criei com algumas configurações muito utilizadas em outros projetos. A estrutura é baseada em MVC e a linguagem é javascript.

  • Padrão REST
  • Testes unitários
  • Testes de integração
  • Framework Jest

⚙️ Tecnologias

Esse projeto foi desenvolvido com as seguintes tecnologias:

Tecnologia Descrição
Node.js Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine
Express.js Fast, unopinionated, minimalist web framework for Node.js
Nodemon Nodemon is a utility depended on by over 1.5 million projects, that will monitor for any changes in your source and automatically restart your server. Perfect for development.
Sucrase Super-fast Babel alternative
dotenv Dotenv is a zero-dependency module that loads environment variables from a .env file into process.env.
cross-env Run scripts that set and use environment variables across platforms
ESLint Find and fix problems in your JavaScript code
Prettier An opinionated code formatter
Docker Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
Sequelize Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. It features solid transaction support, relations, eager and lazy loading, read replication and more.
PostgreSQL PostgreSQL: The World's Most Advanced Open Source Relational Database
Jest Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
Sucrease Jest This is a simple Jest plugin that makes it easy to use Sucrase when running Jest tests.
Supertest The motivation with this module is to provide a high-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent.
Faker generate massive amounts of fake data in the browser and node.js
Factory Girl factory-girl is a factory library for Node.js and the browser that is inspired by Factory_girl. It works asynchronously and supports associations and the use of functions for generating attributes.
Yup Yup is a JavaScript schema builder for value parsing and validation.
Validator A library of string validators and sanitizers.
JWT JSON Web Tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties.
bcrypt A library to help you hash passwords. bcrypt is a password-hashing function designed by Niels Provos and David Mazières, based on the Blowfish cipher and presented at USENIX in 1999

🔧 Instalação

Faça um clone desse repositório utilizando o comando git clone ou faça download.

  git clone https://github.com/sandro-dev/node-tdd-jest

Pré-requisitos

Obs.: Todos os comandos em yarn podem ser substituídos por npm yarn add -> npm install

  • A partir da pasta raiz do projeto, execute o comando yarn para instalar as dependências:
    yarn
  • Execute o comando cp .env.example .env e preencha o arquivo .env com suas variáveis de ambiente, para que tudo funcione perfeitamente;

Agora vamos instalar duas imagens de bancos de dados:

  • Primeiro vamos instalar o Postgres, para armazenar nossas tabelas. Execute o seguinte comando no terminal:
  docker run --name postgres -e POSTGRES_PASSWORD=docker -p 5432:5432 -d postgres

Vamos configurar o banco de dados:

  • Crie um novo banco de dados postgres com o nome que colocou em DB_HOST

  • Rode o comando abaixo para executar as migrations, e criar a tabela no banco de dados;

  yarn sequelize db:migrate

Agora, vamos popular a tabela users:

  yarn sequelize db:seed:all

Vamos colocar o servidor para rodar. Digite o seguinte comando:

  yarn dev

📷 Screenshots

📝 Licença

Esse projeto está sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.


Feito com ♥ by Sandro Santos | Me add no LinkedIn

About

basic node project using TDD with Jest, server in Express and tools to lint the code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published