Home > @unseenco/backstage-core > getProject
getProject() function
Returns a project of the given id, or creates one if it doesn't already exist.
Signature:
typescript
export declare function getProject(id: string, config?: IProjectConfig): IProject;Parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | |
| config | IProjectConfig |
Returns:
Remarks
If @unseenco/backstage/studio is also loaded, then the state of the project will be managed by the studio.
[Learn more about exporting](https://www.backstagejs.com/docs/latest/manual/projects\#state)
Example 1
Usage:
ts
import {getProject} from '@unseenco/backstage'
const config = {} // the config can be empty when starting a new project
const project = getProject("a-unique-id", config)Example 2
Usage with an explicit state:
ts
import {getProject} from '@unseenco/backstage'
import state from './saved-state.json'
const config = {state} // here the config contains our saved state
const project = getProject("a-unique-id", config)