2020-03-16 21:27:32 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:17:35 +03:00
2020-03-16 21:26:13 +03:00
2020-03-16 21:17:35 +03:00

This is a next-apollo-graphql setup to start develop your web site. This setup uses server side rendering.

🚀 Getting Started

To start the development server, you need to run the following commands below.

npm install
npm run dev

Open http://localhost:3000 with your browser to see the result.

Our application runs on port 3000, and GraphQL server also runs on localhost:3000/api/graphql.

⚡ Using Query

You can easily use Query component to send queries to the GraphQL server. Just pass your query to the Query component.

<Query query={ARTICLES_QUERY}>
    {({ data: { articles } }) => {
        return <Articles articles={articles} />;
    }}
</Query>

Use the withData HOC to wrap your pages.


// ./frontend/pages/articles.js
import Layout from '../components/Layout/Layout'
import SEO from '../components/SEO/SEO'
import Query from '../components/Query/query'
import ARTICLES_QUERY from '../apollo/queries/articles/articles';
import withData from '../lib/apollo';


const Articles = () => {
    return (
        <>
            <SEO pageTitle='Articles page' />
            <Layout>
                <h1>Articles page</h1>
                <div>
                    <Query query={ARTICLES_QUERY}>
                        {({ data: { articles } }) => {
                            return articles.map(art => {
                                return (
                                    <div key={art.id}>
                                        <p>
                                            title: {art.title} <br />
                                            id: {art.id}
                                        </p>
                                    </div>
                                )
                            })
                        }}
                    </Query>
                </div>
            </Layout>
        </>  
    )
  
}

export default withData(Articles)

License:

MIT

This is a next-strapi-mongo setup to start develop your web site. This setup uses server side rendering.

Description
Use this setup to start develop your web site with NextJs, GraphQL and Apollo
Readme MIT 413 KiB
Languages
JavaScript 95.7%
SCSS 2.2%
Dockerfile 2.1%