
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@ng-web-apis/universal
Advanced tools
A set of fallback for @ng-web-apis/common for Angular Universal
A set of fallbacks to seamlessly use @ng-web-apis/common in Angular Universal apps. These packages have synced versions down to minor.
Add constants imported from this package to providers of your ServerAppModule
. Typically, you can also use these mocks
for tests. Idea of this package is — you shouldn't have to mock DOM on the server side or test isPlatformBrowser
all
the time. Instead, you leverage Angular DI system to abstract from implementation. When possible, this package will
provide the same functionality on the server side as you have in browser. In other cases you will get type-safe mocks
and you can at least be sure you will not have cannot read property of null
or undefined is not a function
errors in
SSR.
You can import UNIVERSAL_PROVIDERS
in the following manner:
const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),
UNIVERSAL_PROVIDERS, // <-- add this
],
};
const config = mergeApplicationConfig(appConfig, serverConfig);
const bootstrap = () => bootstrapApplication(AppComponent, config);
When you use plain SSR without prerender you can retrieve some of the information from requests. Use the following helpers to harvest that info:
server.ts:
import {provideLocation, provideUserAgent} from '@ng-web-apis/universal';
// ...
app.get('/**/*', (req: Request, res: Response) => {
res.render('../dist/index', {
req,
res,
providers: [provideLocation(req), provideUserAgent(req)],
});
});
FAQs
A set of fallback for @ng-web-apis/common for Angular Universal
The npm package @ng-web-apis/universal receives a total of 3,209 weekly downloads. As such, @ng-web-apis/universal popularity was classified as popular.
We found that @ng-web-apis/universal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.