Skip to content

Instantly share code, notes, and snippets.

View arminyahya's full-sized avatar
💭
Open to work

Armin Yahya arminyahya

💭
Open to work
View GitHub Profile
var MoviesList = [
{
id: 1,
title: 'Avengers: Endgame',
rate: '8.7',
year: 2019
},
{
id: 2,
title: 'John Wick: Chapter 3 - Parabellum',
var UserList = [
{
id: 1,
username: 'armin',
password: '12345',
},
{
id: 2,
username: 'fred',
password: '54321'
var { UserList } = require('../user-list');
module.exports = (req, res, next) => {
const username = req.get('username');
const password = req.get('password');
const user = UserList.find(user => user.username === username);
if (!user) {
req.isAuth = false;
return next();
}
import React from "react"
import Layout from "../components/layout"
import SEO from "../components/seo"
import { useStaticQuery, graphql } from "gatsby"
import StarIcon from "../Icons/starIcon"
const IndexPage = () => {
const { movie } = useStaticQuery(
graphql`
query MyQuery {
module.exports = {
siteMetadata: {
title: `Gatsby With Express`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
module.exports = {
siteMetadata: {
title: `Gatsby With Express`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
var express = require('express');
var express_graphql = require('express-graphql');
var { schema, root} = require('./schema');
// Create an express server and a GraphQL endpoint
var app = express();
app.use('/graphql', express_graphql({
schema: schema,
rootValue: root,
graphiql: true
var MoviesList = [
{
id: 1,
title: 'Avengers: Endgame',
rate: '8.7',
Year: 2019
},
{
id: 2,
title: 'John Wick: Chapter 3 - Parabellum',
var { buildSchema } = require('graphql');
var { MoviesList } = require('./movie-list');
var schema = buildSchema(`
type Query {
movieInfo(id: Int!): Movie
movieList(rate: String): [Movie]
},
type Movie {
id: Int
import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import Image from "../components/image"
import SEO from "../components/seo"
import { useStaticQuery, graphql } from "gatsby"
const IndexPage = () => {
const MovieResult = useStaticQuery(
graphql`