![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@sgfe/sapi-runtime-web
Advanced tools
A runtime environment for building and deploying web applications.
nestjs module that just doing little modification to the original and good nestjs http module.
.toPromise()
every http call.{ retries: NUMBER_OF_RETRIES }
in the config of the http module.
more details in the configuration sectionUsing npm:
$ npm install nestjs-http-promise
Using yarn:
$ yarn add nestjs-http-promise
import the module:
import { HttpModule } from 'nestjs-http-promise'
@Module({
imports: [HttpModule]
})
inject the service in the class:
import { HttpService } from 'nestjs-http-promise'
class Demo {
constructor(private readonly httpService: HttpService) {}
}
use the service:
public callSomeServer(): Promise<object> {
return this.httpService.get('http://fakeService')
}
the service uses axios and axios-retry, so you can pass any AxiosRequestConfig And/Or AxiosRetryConfig
just pass it in the .register()
method as you would do in the original nestjs httpModule
import { HttpModule } from 'nestjs-http-promise'
@Module({
imports: [HttpModule.register(
{
timeout: 1000,
retries: 5,
...
}
)]
})
When you need to pass module options asynchronously instead of statically, use the registerAsync()
method just like in nest httpModule.
you have a couple of techniques to do it:
HttpModule.registerAsync({
useFactory: () => ({
timeout: 1000,
retries: 5,
...
}),
});
HttpModule.registerAsync({
useClass: HttpConfigService,
});
Note that in this example, the HttpConfigService has to implement HttpModuleOptionsFactory interface as shown below.
@Injectable()
class HttpConfigService implements HttpModuleOptionsFactory {
async createHttpOptions(): Promise<HttpModuleOptions> {
const configurationData = await someAsyncMethod();
return {
timeout: configurationData.timeout,
retries: 5,
...
};
}
}
If you want to reuse an existing options provider instead of creating a copy inside the HttpModule, use the useExisting syntax.
HttpModule.registerAsync({
imports: [ConfigModule],
useExisting: ConfigService,
});
FAQs
A runtime environment for building and deploying web applications.
We found that @sgfe/sapi-runtime-web demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.