New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/sandersoncoelho/go-expert/multithreading

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sandersoncoelho/go-expert/multithreading

  • v0.0.0-20241118005838-d8b3fe6767ab
  • Source
  • Go
  • Socket score

Version published
Created
Source

Multithreading

In this challenge we have an endpoint that called two external service, cepbrasil and viacep. The first service response to return, will be showed to the client, and the other service response will be discarded. We use go routines to called the both services simultaneously.

Running the applications

Run the server in a terminal

~/go-expert cd multithreading
~/multithreading go run cmd/server/main.go

Call the endpoint in other terminal passing the cep at the request http://localhost:8000/ceps/{cep_query}

curl  http://localhost:8000/ceps/01153000

Comments

The response to the client must return which service has returned first as well its data, such as:

{
   "serviceName":"brasilapi",
   "data":{
      "cep":"01153000",
      "city":"São Paulo",
      "neighborhood":"Barra Funda",
      "street":"Rua Vitorino Carmilo",
      "service":"open-cep"
   }
}

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc