1.0.11 • Published 3 years ago
ideompotentcy-validator v1.0.11
:About
I am an express js API middleware .I will make your API request Idempotent and restrict duplicate API request.
:Features
- create an active token for each post request
- validate token on each request
:Configuration
import express from 'express'
import {GqlConfig,validateToken} from 'ideompotent-a'
const app = express()
const gqlConfig:GqlConfig = new GqlConfig('https://graphqlhost.in/v1/graphql')
let headers = { 'auth' :'xxxx'}
gqlConfig.setHeaders(headers)
const graphqlConfig:GraphQLClient = gqlConfig.getGqlConfig()
app.use(validateToken)
:Technologies
The following tools were used in this project:
:Requirements
Database Configuration
Make your Database like this
- Schema : transaction
Table : token
- Fields : \ id :In---> auto-generated id\ ref_id :Int ---> process respective to transaction (eg: bank_account_no,employee_id)\ token :String ---> auto-generated UUID -> primary key\ process :String ---> process name (Foreign key to )\ is_active :Boolean ---> token status\ is_request_received:Boolean ---> token request received at\ request:String ---> Request\ request_received_at:timestamp\ initiated_at:timestamp\ response:String ---> Response\ completed_at:timestamp\ status:String ---> transction status\ steps:String ---> Error Occured Stage
Table : process
Fields :\ id :Int ---> auto-generated id\ name:String ---> process name (eg: BOOK_ORDER,CANCEL_ORDER )\ entity:String ---> process respective to (eg: ORDER , PAYMENT )
Graphql :
Either use Hasura Graphql Query or Follow Hasura Graphql Query Standards for Graphql Query and mutation for Database actions \ eg:
query getToken(($token: String!) {
transaction_token_by_pk(token: $token) {
ref_id
is_active
is_request_received
request
response
process
initiated_at
completed_at
}
}
:License
This project is un-licensed.
Made with :heart: by Sanjay Kumar
Back to top