Skip to content

Motirck/NLW-Rocketseat-NodeJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 

Repository files navigation


Next Level Week 06 of Rocketseat - Mission Node.js 🚀🚀🚀

Next Level Week Ticket - Ricardo


Status: 🥂✨ Completed ✨🥂


Keywords 🔑

  • typescript -> ts
  • javascript -> js

Project Rules 📌

  • Users Registration

    • It isn't allowed register more than one user with the same email address
    • It isn't allowed register user without email address
  • Tags Registration

    • It isn't allowed register more than one tag with the same name
    • It isn't allowed register user without name
    • It isn't allowed register a tag for non admin user
  • Compliment Registration

    • It isn't allowed an user register a compliment for yourself
    • It isn't allowed register a compliment for invalid users
    • The user must be authenticated on the application

Necessary Commands


⚠️Should you want to create this project from zero, run all of the commands below, if not, just run npm install --global yarn and yarn install instead⚠️


npm install --global yarn

yarn init -y

yarn add typescript -D (install TS only in development)

yarn tsc --init (create the tsconfig.json file)

yarn add express

yarn add @types/express -D

yarn add ts-node-dev -D (automatically convert TS to JS)

yarn add typeorm reflect-metadata sqlite3

yarn typeorm migration:create -n CreateUsers

yarn typeorm migration:run

yarn typeorm entity:create -n User (do this after added in the ormconfig.json the code "entitiesDir": "src/entity" below)

"cli": {
    "migrationsDir": "src/database/migrations",
    "entitiesDir": "src/entity"
}

yarn add uuid

yarn add @types/uuid -D

yarn add express-async-errors

yarn typeorm migration:create -n CreateTags

yarn typeorm migration:run

yarn typeorm entity:create -n Tag

yarn add jsonwebtoken

yarn add @types/jsonwebtoken -D

yarn typeorm migration:create -n AlterUserAddColumnPassword

yarn typeorm migration:run

yarn add bcryptjs

yarn add @types/bcryptjs -D

yarn typeorm migration:create -n CreateCompliments

yarn typeorm migration:run

yarn typeorm entity:create -n Compliment

yarn add class-transformer (It is a library that allows you to customize entities.)

yarn add cors (library needed when front-end makes API requests)

yarn add @types/cors -D


Commands that were used to do the API documentation using Swagger


yarn add swagger-ui-express

yarn add @types/swagger-ui-express -D


General Tips 💡


  1. Useful commands:

yarn tsc (converte ts para js)

yarn dev (utilizado para rodar o projeto após a instalação do ts-node-dev)


  1. Configurations below in package.json is used to transform the code js in code ts using te ts-node-dev in a automatic way.
"scripts": {
    "dev": "ts-node-dev src/server.ts"
}
  1. How to revert a migration:

yarn typeorm migration:revert

About

Next Level Week da Rocketseat - Nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published