contentbas v0.0.5
What is Contentbas?
Contentbas is a Angular service that provides a set of basic objects for the Contentful HeadlessCMS. Contentbas allows Front-end Developers to use Contentful without developing a custom backend API or Service. The service is intended to be used for small websites with simple or basic requirements.
Core Features
- Flexible content objects.
- Designed to be useful for Contentful Free Tier.
- No Middleware API for Front-end Developers.
- Image and Rich HTML support.
Requirements
- A Contentbas API account and access token.
- A Contentful API account and access token.
- Contentful content models to be created in Contentful that follow the Contentbas model schema (more below).
- Contentful rich html text renderer module.
Compatibility
Not backwards compatible with View Engine, using Ivy.
Installation
I do not recommend installing at the time! Requires private API key only available to beta testers. The project is in development and is unstable. Please wait for a production release. There is no timetable at this moment. No documentation exists for this service at this time.
Install modules:
npm install contentbas
npm install @contentful/rich-text-html-renderer
Contentful Content Models:
Currently just for Beta testers. So don't use this service yet! ;-)
Develop Access Tokens
Thank you for showing interest, at this time tokens are just for our team.
Usage
In your Module:
import { ContentbasModule } from 'contentbas';
@NgModule({
...
imports: [
...,
ContentbasModule,
],
...
})
In your environment.ts
export const environment = {
...
CONTENTBAS_CLIENT: {
contentbas_access_token: [YOUR_CONTENTBAS_ACCESS_TOKEN],
contentful_access_token: [YOUR_CONTENTFUL_ACCESS_TOKEN],
contentful_space_id: [YOUR_CONTENTFUL_SPACE_ID]
}
};
In your Component or Service:
import { ContentbasService } from 'contentbas';
import { environment } from 'src/app/environments/environment';
...
constructor(private contentbas: ContentbasService) {
this.contentbas.CLIENT = environment.CONTENTBAS_CLIENT;
}
ngOnInit(): void {
// get label or labels
this.contentbas.getLabel([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
this.contentbas.getLabels().then(resp => {console.log(resp)});
this.contentbas.getMultiLabel([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
this.contentbas.getMultiLabels().then(resp => {console.log(resp)});
this.contentbas.getBlock([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
this.contentbas.getBlocks().then(resp => {console.log(resp)});
this.contentbas.getProfile([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
this.contentbas.getProfiles().then(resp => {console.log(resp)});
this.contentbas.getProduct([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
this.contentbas.getProducts().then(resp => {console.log(resp)});
this.contentbas.getImage([CONTENTFUL_ENTRY_ID]).then(resp => {console.log(resp)});
}
...
Developer Notes
Thank you for stumbling upon this, I hope it will be useful in the future.