All Projects → ng-web-apis → universal

ng-web-apis / universal

Licence: MIT license
A counterpart to common package to be used with Angular Universal

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to universal

Ngx Meta
Dynamic page title & meta tags utility for Angular (w/server-side rendering)
Stars: ✭ 331 (+187.83%)
Mutual labels:  dom, universal, server-side-rendering
Universal React
A universal react starter, with routing, meta, title, and data features
Stars: ✭ 247 (+114.78%)
Mutual labels:  universal, server-side-rendering
Razzle Material Ui Styled Example
Razzle Material-UI example with Styled Components using Express with compression
Stars: ✭ 117 (+1.74%)
Mutual labels:  universal, server-side-rendering
Beidou
🌌 Isomorphic framework for server-rendered React apps
Stars: ✭ 2,726 (+2270.43%)
Mutual labels:  universal, server-side-rendering
React Redux Saucepan
A minimal and universal react redux starter project. With hot reloading, linting and server-side rendering
Stars: ✭ 86 (-25.22%)
Mutual labels:  universal, server-side-rendering
React Prepare
Prepare you app state for async server-side rendering and more!
Stars: ✭ 100 (-13.04%)
Mutual labels:  universal, server-side-rendering
Reactql
Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
Stars: ✭ 1,833 (+1493.91%)
Mutual labels:  universal, server-side-rendering
ult
The Ultimate Dev Stack
Stars: ✭ 54 (-53.04%)
Mutual labels:  native, universal
app-monorepo
Secure, open source and community driven crypto wallet runs on all platforms and trusted by millions.
Stars: ✭ 1,282 (+1014.78%)
Mutual labels:  native, universal
Marko
A declarative, HTML-based language that makes building web apps fun
Stars: ✭ 10,796 (+9287.83%)
Mutual labels:  dom, server-side-rendering
Universal React Demo
ES6 demo of a simple but scalable React app with react-router, code splitting, server side rendering, and tree shaking.
Stars: ✭ 50 (-56.52%)
Mutual labels:  universal, server-side-rendering
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+1514.78%)
Mutual labels:  native, universal
Universal
Seed project for Angular Universal apps featuring Server-Side Rendering (SSR), Webpack, CLI scaffolding, dev/prod modes, AoT compilation, HMR, SCSS compilation, lazy loading, config, cache, i18n, SEO, and TSLint/codelyzer
Stars: ✭ 669 (+481.74%)
Mutual labels:  universal, server-side-rendering
Sambell
wake me when it's quitting time
Stars: ✭ 101 (-12.17%)
Mutual labels:  universal, server-side-rendering
Awesome Nextjs
📔 📚 A curated list of awesome resources : books, videos, articles about using Next.js (A minimalistic framework for universal server-rendered React applications)
Stars: ✭ 6,812 (+5823.48%)
Mutual labels:  universal, server-side-rendering
Universal Starter
Angular 9 Universal repo with many features
Stars: ✭ 518 (+350.43%)
Mutual labels:  universal, server-side-rendering
Go Starter Kit
[abandoned] Golang isomorphic react/hot reloadable/redux/css-modules/SSR starter kit
Stars: ✭ 2,855 (+2382.61%)
Mutual labels:  universal, server-side-rendering
Cra Universal
🌏 Create React App companion for universal app. No eject, auto SSR, zero config, full HMR, and more (inactive project)
Stars: ✭ 419 (+264.35%)
Mutual labels:  universal, server-side-rendering
Onthefly
🔗 Generate TinySVG, HTML and CSS on the fly
Stars: ✭ 37 (-67.83%)
Mutual labels:  dom, server-side-rendering
Slim.js
Fast & Robust Front-End Micro-framework based on modern standards
Stars: ✭ 789 (+586.09%)
Mutual labels:  native, dom

logo Angular Universal fallbacks

Part of Web APIs for Angular

npm version npm bundle size Travis (.org) Coveralls github

A set of fallbacks to seamlessly use @ng-web-apis/common in Angular Universal apps. These packages have synced versions down to minor.

How to use

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 propery of null or undefined is not a function errors in SSR.

IMPORTANT: This library relies on Node.js v10 and above on your server side

Mocks

Add following line to your server.ts to mock native classes used in other @ng-web-apis packages:

import '@ng-web-apis/universal/mocks';

It is recommended to keep the import statement at the top of your server.ts file

Tokens

You can provide tokens from this package into your app.server.module.ts to have type safe mocks for global objects on server side with UniversalModule:

@NgModule({
    imports: [
        AppBrowserModule,
        ServerModule,
        UniversalModule, // <-- add this
    ],
    bootstrap: [AppComponent],
})
export class AppServerModule {}

Special cases

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)],
    });
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].