0.0.10 • Published 2 years ago

contentstack-content-delivery-module v0.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

contentstack-content-delivery-module

contentstack-content-delivery-module is a module for connecting contenstack backend with your nuxt app. Using our module you can fetch contentstack api and display the data accroding to the requirements.

Installation

Use the node package manager to install contentstack-content-delivery-module

npm i contentstack-content-delivery-module

Add module in nuxt.config.js file

Add contentstack-content-delivery-module module in nuxt.config.js file.

export default {
  build: {
    transpile: ['contentstack-content-delivery-module']
  },
  modules: [
    'contentstack-content-delivery-module'
  ],
  contentful: {
    default: 'master',
    activeEnvironments: ['master'],
    environments: {
      master: {
        apiKey: process.env.CONTENTSTACK_API_KEY,
        accessToken: process.env.CONTENTSTACK_DELIVERY_TOKEN,
        environment: process.env.CONTENTSTACK_ENVIRONMENT
      }
    }
  }
}

Create .env file in your root folder.

# provide stack & region details below

CONTENTSTACK_API_KEY = {api_key_of_your_stack}
CONTENTSTACK_DELIVERY_TOKEN = {delivery_token_of_the_environment}
CONTENTSTACK_ENVIRONMENT = {environment_name}
CONTENTSTACK_REGION = eu  //Compulsory param for EU users. NA users need not add this param.
CONTENTSTACK_CUSTOM_HOST = <URL where website is hosted> //Optional. Use this for updating URL in sitemap.xml page.

Usage

Add the following script to your .vue file and use it in your template.

	<script>
	async asyncData({ app }) {
		const response1 =
		await app.$contentstack.client.getSpecificEntryByUrlAndReference(
			'page',
			['page_components.from_blog.featured_blogs'],
			'/'
		)
		return {
		response1: response1[0][0],
		}
	  },
	}
	</script>
0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago