- Typescript
- Node
- Hapi
- Swagger
- Typeorm
- Joi
- Postgres
- Jest
- JWT
Test api about a test bank.
For now there are just CRUDs and basic features about account and bank management.
- Docker
- Docker Compose
- An IDE, I recommend Visual Studio Code
After installing all the prerequisites
- Import the project using your favorite IDE
- Download all dependencies with yarn or npm
- After you'll need to up the docker image with postgres, then tip the following command
$ sudo docker-compose up -d- Run yarn start
- You can check the endpoints on swagger.io
http://localhost:3000/documentation
- You need to login to get an token
{{host}}/auth
{
"username": "test-user",
"password": "@changeme"
}
-
Get token property returned
-
To test in Swagger you need to click on big button
Authorization -
Paste the code, but before you need to digit Bearer Ex:
Bearer TOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKENTOKEN
- And don't forget to run request in HTTPS mode in swagger
- Postman or Insomnia (Test endpoints)
- DBeaver (Manage database)
NODE_ENV=local
DATABASE_HOST="localhost"
DATABASE_PORT=5454
DATABASE_USERNAME="postgres"
DATABASE_PASSWORD="@changeme"
DATABASE_NAME="postgres"
JWT_AUDIT="aud:test-bank"
JWT_ISSUER="issuer:test-bank"
JWT_SECRET="your-secret"
JWT_VALID_IN_SECONDS=14400
USER_MOCK_USERNAME="test-user"
USER_MOCK_PASSWORD="@changeme"
USER_MOCK_EMAIL="test-user@test.com"