Skip to content

Instantly share code, notes, and snippets.

@jferrettiboke
jferrettiboke / cms-database.js
Last active September 7, 2021 11:38
Map CMS modules to React.js components idea
// CMS
const pages = [
{
id: "1",
slug: "/",
modules: [
{ type: "hero", title: "Hero title", description: "Hero description" },
{ type: "image", title: "Image title", url: "https://..." },
],
},
const express = require('express');
const bodyParser = require('body-parser');
// 1. Importamos `graphiqlExpress`.
const { graphqlExpress, graphiqlExpress } = require('graphql-server-express');
const { makeExecutableSchema } = require('graphql-tools');
const typeDefs = [
`
type Query {
hello: String
// 1. Importamos dependencias.
const express = require('express');
const bodyParser = require('body-parser');
const { graphqlExpress } = require('graphql-server-express');
const { makeExecutableSchema } = require('graphql-tools');
// 2. Definimos los diferentes tipos en nuestro schema.
const typeDefs = [
`
type Query {
// 1. Importamos dependencias.
const { graphql, buildSchema } = require('graphql');
// 2. Construimos un schema GraphQL usando GraphQL Schema Language.
const schema = buildSchema(
`
type Query {
hello: String
}