Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Docs v5 #318

Merged
merged 9 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Nikcio.UHeadless.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nikcio.UHeadless.Integratio
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{35E640D8-E023-4EAE-8F6A-DA111530CFB7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "code-examples", "examples\code-examples\code-examples.csproj", "{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "code-examples", "examples\code-examples\code-examples.csproj", "{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "starter-example", "examples\starter-example\starter-example.csproj", "{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -53,6 +55,10 @@ Global
{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7}.Release|Any CPU.Build.0 = Release|Any CPU
{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -62,6 +68,7 @@ Global
{AB38DFEA-A643-44A0-BFC1-B38B163C62C6} = {9E422C4D-CDA0-486D-8201-1C48E5DF758C}
{87F86EB5-6EE0-4E7A-9D1D-4732E050F772} = {9E422C4D-CDA0-486D-8201-1C48E5DF758C}
{3A9D1882-B230-49DD-B0F3-0CE1134CE6D7} = {35E640D8-E023-4EAE-8F6A-DA111530CFB7}
{3E7F0679-EBDD-4158-8AA5-CFDC7CDC4FF2} = {35E640D8-E023-4EAE-8F6A-DA111530CFB7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {35FA3052-75A6-4E60-8C6B-1882EE08D1CD}
Expand Down
115 changes: 60 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Nikcio.UHeadless package is compatible with the following Umbraco versions:
|----------------------|-----------------------|
| Umbraco 10 | v3.x.x |
| Umbraco 12 | v4.x.x |
| Umbraco 13 | v4.2.x+ |
| Umbraco 13 | v4.2.x+ & v5.x.x |

For more information, please refer to the [Versioning](#versioning) section.

Expand All @@ -36,76 +36,81 @@ You can also find the package on [NuGet](https://www.nuget.org/packages/Nikcio.U

To integrate the package into your project, follow these steps:

1. Open your `Startup.cs` file.
2. Add the following using statement:
1. Open your `program.cs` file.
2. Add the following using statements:

```csharp
using Nikcio.UHeadless.Extensions;
```
```csharp
using Nikcio.UHeadless;
using Nikcio.UHeadless.Defaults.ContentItems;
```

3. In the `ConfigureServices` method, add the following code:
3. In the `CreateUmbracoBuilder` method, add the following code:

```csharp
public void ConfigureServices(IServiceCollection services)
{
services.AddUmbraco(_env, _config)
/* Code omitted for clarity */
.AddUHeadless()
/* Code omitted for clarity */
}
```
```csharp
builder.CreateUmbracoBuilder()
// Default Umbraco configuration
.AddUHeadless(options =>
{
options.DisableAuthorization = true; // Change this later when adding authentication - See documentation

4. In the `Configure` method, add the following code:
options.AddDefaults();

```csharp
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
/* Code omitted for clarity */
options.AddQuery<ContentByRouteQuery>();
options.AddQuery<ContentByGuidQuery>();
})
.Build();
```

app.UseUHeadlessGraphQLEndpoint();
4. Then after `app.BootUmbracoAsync()` method, add the following code:

app.UseUmbraco()
/* etc... */
}
```
```csharp
await app.BootUmbracoAsync();

With these configurations in place, your content will be available at `/graphql`. To get started, try adding some content to the root and run the following query:
app.UseAuthentication();
app.UseAuthorization();

```graphql
{
contentAtRoot {
nodes {
id,
name
}
}
}
```
GraphQLEndpointConventionBuilder graphQLEndpointBuilder = app.MapUHeadless();

## Documentation
// Only enable the GraphQL IDE in development
if (!builder.Environment.IsDevelopment())
{
graphQLEndpointBuilder.WithOptions(new GraphQLServerOptions()
{
Tool =
{
Enable = false,
}
});
}

For detailed documentation and usage instructions, please refer to the [Nikcio.UHeadless Documentation](https://nikcio.github.io/Nikcio.UHeadless).
app.UseUmbraco()
// Default Umbraco configuration
```

## Extending Packages
With these configurations in place, your content will be available at `/graphql`.

Nikcio.UHeadless offers various packages for extending its functionality. The following table lists the available packages and their current status:
To get started, try querying your content using their GUIDs or routes. For example with the query below:

| Package Name | Status |
| --------------------------------- | ------------ |
| Nikcio.UHeadless.Content | Included* |
| Nikcio.UHeadless.Media | Included* |
| Nikcio.UHeadless.ContentTypes | Included* |
| Nikcio.UHeadless.Members | Available |
| Nikcio.UHeadless.DataTypes | Not started |
| Nikcio.UHeadless.Dictionary | Not started |
| Nikcio.UHeadless.MediaTypes | Not started |
| Nikcio.UHeadless.MemberTypes | Not started |
__Tip: GUIDs can be found in the info tab when viewing content in the backoffice__

\***Included** indicates that the package is included in the Nikcio.UHeadless NuGet package.
```graphql
query {
contentByGuid(id: "dcf18a51-6919-4cf8-89d1-36b94ce4d963") {
id
key
name
statusCode
templateId
updateDate
url(urlMode: ABSOLUTE)
urlSegment
}
}
```

\*\***Preview** indicates that the package is available in a preview version.
## Documentation

Please note that if a Nikcio.UHeadless.\* package is not listed above, it either means that the package is not ready for use or it is a core/base package used in the packages mentioned above.
For detailed documentation and usage instructions, please refer to the [Nikcio.UHeadless Documentation](https://nikcio.github.io/Nikcio.UHeadless).

## Versioning

Expand All @@ -127,7 +132,7 @@ vX.Y.Z
| Umbraco 10 | v2.x.x & v3.x.x | Only reported issues for v3.x.x |
| Umbraco 11 | v3.x.x & v4.x.x | No development |
| Umbraco 12 | v4.x.x | Only reported issues for v4.x.x |
| Umbraco 13 | v4.2.x+ | Active branch |
| Umbraco 13 | v4.2.x+ & v5.x.x | Active branch (v5.x.x) |

## Contributing

Expand Down
3 changes: 2 additions & 1 deletion examples/code-examples/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "umbraco",
"applicationUrl": "https://localhost:44371;https://localhost:11129",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}
1 change: 0 additions & 1 deletion examples/code-examples/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"Global": {
"Id": "d173c8c2-e412-4a6a-960f-5feeed9a4189",
"SanitizeTinyMce": true,
"MainDomLock": "SqlMainDomLock",
"UseHttps": true,
"InstallMissingDatabase": true
},
Expand All @@ -34,7 +33,7 @@
"InstallUnattended": true,
"UnattendedUserName": "test",
"UnattendedUserEmail": "[email protected]",
"UnattendedUserPassword": "D@2#1*4E&Fs3tN#3mK6LFZAky^MlrC",

Check warning on line 36 in examples/code-examples/appsettings.json

View workflow job for this annotation

GitHub Actions / Build and analyze

"password" detected here, make sure this is not a hard-coded credential. (https://rules.sonarsource.com/csharp/RSPEC-2068)
"UpgradeUnattended": true
},
"Content": {
Expand Down
Binary file modified examples/code-examples/umbraco/Data/code-examples.sqlite
Binary file not shown.
Loading
Loading