Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raulpe7eira/valoriza
nlw#6 - trilha nodejs from rocketseat by Rafael Camarda
https://github.com/raulpe7eira/valoriza
jwt learn nlw nlw-6-nodejs nodejs rocketseat sqlite typeorm typescript
Last synced: about 11 hours ago
JSON representation
nlw#6 - trilha nodejs from rocketseat by Rafael Camarda
- Host: GitHub
- URL: https://github.com/raulpe7eira/valoriza
- Owner: raulpe7eira
- Created: 2021-06-26T08:56:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-18T23:49:54.000Z (12 months ago)
- Last Synced: 2024-12-19T08:14:05.453Z (about 2 months ago)
- Topics: jwt, learn, nlw, nlw-6-nodejs, nodejs, rocketseat, sqlite, typeorm, typescript
- Language: TypeScript
- Homepage:
- Size: 89.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Valoriza API
This repository is the code corresponding to the [nlw#6 - trilha nodejs](https://nextlevelweek.com/) lab by Rafael Camarda.
> The project simulates an recognition among teammates management API that allows to register users, tags, compliments with authentication and retrieves some listings.
## Gets dependencies, setups database and starts application
```bash
cd valoriza
npm install
npm run typeorm migration:run
npm run dev
```## How to use?
```bash
# authenticates user
curl -X POST 'http://localhost:3000/login' \
-H 'Content-Type: application/json' \
-d '{
"email": "[email protected]",
"password": "1234"
}'# creates user
curl -X POST 'http://localhost:3000/users' \
-H 'Content-Type: application/json' \
-d '{
"name": "Raul Pereira",
"email": "[email protected]",
"password": "1234",
"admin": true
}'# retrieves created users (
# replaces curly braces:
# {token} : authorization token
# )
curl -X GET 'http://localhost:3000/users' \
-H 'Authorization: {token}'# retrieves received compliments by user (
# replaces curly braces:
# {token} : authorization token
# )
curl -X GET 'http://localhost:3000/users/compliments/receive' \
-H 'Authorization: {token}'# retrieves sent compliments by user (
# replaces curly braces:
# {token} : authorization token
# )
curl -X GET 'http://localhost:3000/users/compliments/send' \
-H 'Authorization: {token}'# creates tag (
# replaces curly braces:
# {token} : authorization token
# )
curl -X POST 'http://localhost:3000/tags' \
-H 'Authorization: {token}' \
-H 'Content-Type: application/json' \
-d '{
"name": "reviewer"
}'# retrieves created tags (
# replaces curly braces:
# {token} : authorization token
# )
curl -X GET 'http://localhost:3000/tags' \
-H 'Authorization: {token}'# creates compliment (
# replaces curly braces:
# {token} : authorization token
# {tag_id} : tag identifier
# {user_id} : user identifier
# )
curl -X POST 'http://localhost:3000/compliments' \
-H 'Authorization: {token}' \
-H 'Content-Type: application/json' \
-d '{
"tag_id": "{tag_id}",
"user_receiver": "{user_id}",
"message": "champion \o/"
}'
```