@communities-webruntime/services
Version:
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
53 lines (33 loc) • 1.5 kB
Markdown
# Lightning Web Runtime :: Core API
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
## Context
Most operations require that a context be already established. The context says a lot about your application and since the compiler is stateless, you will have to establish a context before starting. The context-service provides you with 3 methods: [`startContext`](docs/modules/_context_context_service_.md#startcontext), [`getContext`](docs/modules/_context_context_service_.md#getcontext) and [`endContext`](docs/modules/_context_context_service_.md#endcontext).
### Usage
```javascript
import { startContext } from '/api';
await contextService.startContext(options);
try {
// do something
} finally {
contextService.endContext();
}
```
### Reference
[Context Service Documentation](docs/modules/_context_context_service_.md)
## Generators
TBD
### Usage
Get all the resources for the current application:
```javascript
import { routeService, resourceService } from '/api';
const resources = routeService.getRoutesResources(routes, theme, locale, isDesignMode);
await Promise.all(
resources.map((routeDescriptor) => {
return resourceService.get(routeDescriptor);
})
);
```
### Reference
## Express Middlewares
TBD
### Reference