Projeto demo utilizando os seguintes plugins:
- "@fastify/auth"
- "@fastify/autoload"
- "@fastify/compress"
- "@fastify/cors"
- "fastify-guard"
- "@fastify/helmet"
- "@fastify/jwt"
- "fastify-knexjs"
- "@fastify/multipart"
- "fastify-nodemailer"
- "@fastify/rate-limit"
- "fastify-socket.io"
- "@fastify/static"
npm install
knex (postgresql)
Crie um banco de dados, modifique o arquivo knexfile.js e execute o comando:
npm run migrate
API
npm run dev
Rotas
https://httpie.io/docs#installation
http post http://localhost:3000/users name=Nome password=Senha role=Função
http get http://localhost:3000/users
Auth/JWT
http post http://localhost:3000/auth name=Nome password=Senha
Guard
http delete http://localhost:3000/users/1/delete x-access-token:token
Multipart/Upload
http -f http://localhost:3000/upload @~/avatar.jpg
Configure o nodemailer em src/plugins/nodemailer.js
http post http://localhost:3000/email to=email@email.com subject=Assunto text=Mensagem
Socket.io
npm install http-server
http-server .
http post http://localhost:3000/socket message="Eu sou um socket"