
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
nation-progress-tracker
Advanced tools
Wrapper for the World Bank API, enabling users to fetch and manage country-specific statistics across sectors like economy, education, health, and social development.
This package is a Node.js wrapper for the World Bank API, allowing users to easily fetch and manage country-specific statistics. It provides access to a wide range of indicators across sectors like economic, education, health, social development, and more.
This package enables users to track a nation's development progress over time, offering valuable insights for holding governments accountable, particularly in developing and underdeveloped countries. By leveraging data from the World Bank, it helps highlight areas of improvement and transparency. Users can look up any specific indicators listed by the World Bank.
Install the package via npm:
npm install nation-progress-tracker
Or using yarn:
yarn add nation-progress-tracker
Fetches comprehensive statistics for a given 3-letter country code.
Parameters:
Returns:
Fetches data for a specific indicator for a given country.
Parameters:
Returns:
Fetches all available indicators from the World Bank API.
Parameters:
Returns:
Note: This API may take significant time to execute as it needs to scrape hundreds of pages of results.
Fetches the 3-letter country code for a given country name.
Parameters:
Returns:
Integrate the package with an Express.js server to create API endpoints for fetching country statistics and indicators.
Installation:
Ensure Express is installed in your project:
npm install express
Example index.ts
:
import express, { Express, Request, Response } from 'express';
import { getCountryStats, getIndicatorStats, get_all_indicators, get_country3letterCode } from 'nation-progress-tracker';
const app: Express = express();
const port: number = 3000;
app.use(express.json());
app.get('/country-code/:countryName', async (req: Request, res: Response): Promise<void> => {
const countryName: string = req.params.countryName.trim();
try {
const codes: string[] = await get_country3letterCode(countryName);
if (codes.length === 0) {
res.status(404).json({ message: `No country codes found for "${countryName}".` });
return;
}
res.json({ codes });
} catch (error: any) {
console.error(`Error fetching country codes for ${countryName}:`, error.message);
res.status(500).json({ error: 'Failed to fetch country codes' });
}
});
app.get('/country-stats/:country', async (req: Request, res: Response): Promise<void> => {
const country = req.params.country.toUpperCase().trim();
try {
const data = await getCountryStats(country);
res.json(data);
} catch (error: any) {
console.error(`Error fetching country stats for ${country}:`, error.message);
res.status(500).json({ error: 'Failed to fetch data' });
}
});
app.get('/indicator-stats/:country/:indicator', async (req: Request, res: Response): Promise<void> => {
const country = req.params.country.toUpperCase().trim();
const indicator = req.params.indicator.trim();
try {
const data = await getIndicatorStats(country, indicator);
res.json(data);
} catch (error: any) {
console.error(`Error fetching indicator stats for ${country}:`, error.message);
res.status(500).json({ error: 'Failed to fetch data' });
}
});
app.get('/all-indicators', async (_req: Request, res: Response): Promise<void> => {
try {
const data = await get_all_indicators();
res.json(data);
} catch (error: any) {
console.error('Error fetching all indicators:', error.message);
res.status(500).json({ error: 'Failed to fetch data' });
}
});
app.listen(port, (): void => {
console.log(`Server is running on http://localhost:${port}`);
});
Fetches comprehensive statistics for a specified country.
Parameters:
Returns:
CountryStats
object containing detailed statistics.Example Response:
{
"country": "Nepal",
"countryCode": "NPL",
"indicators": {
"Economic Indicators": {
"NY.GDP.MKTP.CD": {
"name": "GDP (current US dollars)",
"data": [
{ "year": "2020", "value": 35000000000 },
{ "year": "2021", "value": 36000000000 }
]
}
},
"Social Indicators": {
"SP.POP.TOTL": {
"name": "Population, total",
"data": [
{ "year": "2020", "value": 30000000 },
{ "year": "2021", "value": 30500000 }
]
}
}
}
}
Fetches data for a specific indicator within a given country.
Parameters:
Returns:
DataEntry
.Example Response:
{
"country": "Nepal",
"countryCode": "NPL",
"indicatorCode": "NE.IMP.GNFS.ZS",
"indicatorName": "Imports of goods and services (% of GDP)",
"data": [
{ "year": "2020", "value": 23.5 },
{ "year": "2021", "value": 24.2 }
]
}
Fetches all available indicators from the World Bank API.
Returns:
AllIndicator
.Example Response:
[
{
"id": "SP.POP.TOTL",
"name": "Population, total",
"sourceOrganization": "World Bank",
"sourceNote": "World Bank data"
},
{
"id": "NY.GDP.MKTP.CD",
"name": "GDP (current US dollars)",
"sourceOrganization": "World Bank",
"sourceNote": "World Bank data"
}
]
Note: This API may take significant time to execute as it scrapes hundreds of pages of results.
Fetches the 3-letter country code for a given country
name.
Parameters:
Returns:
Example Response:
{
"codes": ["NPL"]
}
Contributions are welcome! Please ensure your code follows the project's coding standards and includes relevant tests.
This project is licensed under the MIT License.
FAQs
Wrapper for the World Bank API, enabling users to fetch and manage country-specific statistics across sectors like economy, education, health, and social development.
We found that nation-progress-tracker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.