
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
github.com/KunalDuran/weather-api
Advanced tools
This is a simple Weather API built with Golang that provides weather data for various cities and allows users to register, login, and keep track of their weather search history. Live API URL : https://api.duranz.in
The Weather API provides the following endpoints:
POST /api/login
username and password.Authorization header and in the response body as {"token": "JWT_TOKEN"}.POST /api/register
username, password, and birth_date.Authorization header.GET /api/weather?city={city_name}
city - the city name to get the weather for.GET /api/history
DELETE /api/history/delete?weatherID={weatherID}
weatherID - the ID of the weather history record to delete.DELETE /api/history/bulkdelete
To run the Weather API on your machine, follow these instructions:
Ensure you have Golang (1.18+) installed on your system. If not, download and install it from the official Golang website: https://golang.org/
Clone this repository to your local machine using Git:
git clone https://github.com/KunalDuran/weather-api.git
Change to the project directory:
cd weather-api
Initialize the project and download dependencies using Go modules:
go mod tidy
Create a .env file in the project root directory with the following variables:
DB_USER=mysql_database_user
DB_PASS=mysql_database_password
DB_HOST=mysql_database_host
DB_PORT=mysql_database_port
DB_NAME=weather
API_KEY=your_openweathermap_API_key
Replace the values with your database credentials and the API key you obtained for accessing weather data (e.g., from OpenWeather API).
Build the application:
go build
Run the application:
./weather-api
The API will be running at http://localhost:8080. You can now use API endpoints as described in the "Functionality" section above.
The Weather API uses JWT (JSON Web Tokens) for authentication. When a user logs in or registers, a JWT token is generated and returned, which should be included in the Authorization header for subsequent requests to protected endpoints.
This API uses MySQL as the Database. Creation of Database and Tables is done automatically by the API.
The Weather API allows users to register, log in, fetch weather data for cities, and manage their weather search history. We integrated this API into our Weather application available on https://github.com/KunalDuran/weather-reactjs
FAQs
Unknown package
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
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.