/Messages-manager

simple api email manager to study

Primary LanguageTypeScript

Messages manager

Libraries:

For Cryptography: Bcrypt
For Database ORM: Typeorm , Typeorm Module , PG
For Authenticate and Strategy: Passport , Passport Module , Passport Local , Passport Jwt
For Tests: Jest and Supertest



Start

First install dependecies

If you use NPM

npm install

If you use Yarn

yarn

Run docker-compose

docker-compose up

Start the project from the script

NPM
npm start

Yarn

yarn start

Test yourself

Create a new user

Send a request to route /user containing an application/json {"name","email","password"} with the POST method like this:
curl -X POST http://localhost:3000/user -d '{"name":"example","email": "example@gmail.com", "password": "1234"}' -H "Content-Type: application/json"



Generate new token

Send a request to route /login containing an application/json {"email","password"} with the POST method like this:
curl -X POST http://localhost:3000/login -d '{"email": "example@gmail.com", "password": "1234"}' -H "Content-Type: application/json"



Get Emails

Send a request to route /email containing token Bearer with GET method:
curl -X GET http://localhost:3000/email -H Authorization: Bearer [token]"



Send email

Send a request to route /email/send containing an application/json {"to","content"}, Bearer token with POST method:
curl -X POST http://localhost:3000/email/send -d '{"to":"example@gmail.com","content":"hello world"}' -H "Cobtebt-type: application/json" -H "Authorization: Bearer [token]"




If you want adapt project for you

Edit ormconfig.json file for you

More information about ormconfig.json click here

Edit Typeorm Module in app.module.ts file for configurations equal your ormconfig.json file

More information about TypeormModule click here