![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@nguniversal/hapi-engine
Advanced tools
This is a Hapi Engine for running Angular Apps on the server for server side rendering.
This package has been deprecated. Please use @nguniversal/common
instead.
npm install @nguniversal/hapi-engine --save
To use it, set the engine and then route requests to it
import { Request, Server } from 'hapi';
import { ngHapiEngine } from '@nguniversal/hapi-engine';
const server = new Server();
server.connection({
host: 'localhost',
port: 8000,
});
server.route({
method: 'GET',
path: '/{path*}',
handler: (req: Request) => ngHapiEngine({ req, bootstrap: ServerAppModule }),
});
It is possible to override the default URL and document fetched when the rendering engine
is called. To do so, simply pass in a url
and/or document
string to the renderer as follows:
server.route({
method: 'GET',
path: '/{path*}',
handler: (req: Request) => {
const url = 'http://someurl.com';
const document = '<html><head><title>New doc</title></head></html>';
return ngHapiEngine({
req,
url,
document,
});
},
});
Extra Providers can be provided either on engine setup
const hapiEngine = ngHapiEngine({
bootstrap: ServerAppModule,
providers: [ServerService],
});
The Bootstrap module as well as more providers can be passed on request
server.route({
method: 'GET',
path: '/{path*}',
handler: (req: Request) =>
ngHapiEngine({
bootstrap: OtherServerAppModule,
providers: [OtherServerService],
req,
}),
});
The Request and Response objects are injected into the app via injection tokens.
You can access them by @Inject
import { Request } from 'hapi';
import { REQUEST } from '@nguniversal/hapi-engine/tokens';
@Injectable()
export class RequestService {
constructor(@Inject(REQUEST) private request: Request) {}
}
If your app runs on the client side too, you will have to provide your own versions of these in the client app.
13.1.1 (2022-05-04)
| Commit | Type | Description | | ------------------------------------------------------------------------------------------------ | ---- | ------------------------------------------ | | 4762906c | fix | address service worker generation failures |
Alan Agius
<!-- CHANGELOG SPLIT MARKER --><a name="13.1.0"></a>
FAQs
Hapi Engine for running Server Angular Apps
The npm package @nguniversal/hapi-engine receives a total of 20 weekly downloads. As such, @nguniversal/hapi-engine popularity was classified as not popular.
We found that @nguniversal/hapi-engine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.