showing results for - "nuxt js 27 40nuxtjs 2fmarkdownit 27"
Davide
21 Feb 2016
1export default {
2  async asyncData({ $axios, $md }) {
3
4    //I am also using axios to get the content from the Strapi API.
5    const home = await $axios.$get("/home-page");
6    //This is where I use $md to parse the markdown for the example in the photos.
7    const content = $md.render(home.content);
8
9    const apiRoute = 'http://localhost:1337';
10
11    const heroImageUrl = apiRoute + home.hero_image.url;
12
13    const posts = await $axios.$get("/posts?_limit=4");
14
15    const projects = await $axios.$get("/projects?_limit=2");
16
17    const project = projects[0];
18    const projectImage = apiRoute + project.main_image.url;
19    const projectDescription = $md.render(project.description)
20
21    const secondProject = projects[1];
22    const secondProjectImage = apiRoute + secondProject.main_image.url;
23    const secondProjectDescription = $md.render(secondProject.description)
24
25
26    return {
27      home,
28      heroImageUrl,
29      posts,
30      content,
31      project,
32      projectImage,
33      projectDescription,
34      secondProject,
35      secondProjectImage,
36      secondProjectDescription };
37  },
38};
39
40