Fetch Tanzania nida data
npm install nida-tz
For better result you need axios and dotenv
dependencies installed
This library work with two addition dependency that are ` axios ` and ` dotenv ` modules installed. To install run both ` npm i axios dotenv `
# Syntax
async functionName(parameters);
# sample
const nidatz = require('nida-tz');
const nin = "12345123451234512345"; # define nida
async function mainFunction() => {
const result = await nidatz.nidaData(nin);
};
# express usage
const express = require('express');
const app = expess();
const nidatz = require('nida-tz');
app.get('/route', async (req, res)=>{
const nida = '123456789456123';
const result = await nidatz.nidaData(nida);
res.send(result);
});
app.listen(portNumber, ()=>{});
# separate function usage
const express = require('express');
const app = express();
const nidatz = require('nida-tz');
# Arrow function usage
const nidaResult = async(nida)=>{
return await nidatz.nidaData(nida);
};
# Express usage
app.get('/route', async (req, res)=>{
const nida = '123456789456123';
const result = await nidaResult(nida);
});
app.listen(portNumber, ()=>{});
# separate function usage
const express = require('express');
const app = express();
const nidatz = require('nida-tz');
# Regular function
async function nidaResult(nida){
return await nidatz.nidaData(nida);
};
# Express usage
app.get('/route', async (req, res)=>{
const nida = '123456789456123';
const result = await nidaResult(nida);
});
app.listen(portNumber, ()=>{});