Category : graphql

I wish to place a list of posts on my home page instead of having to create a seperate dynamic page. This is my gatsby-node.js file // DYNAMICALLY CREATE PAGES FOR EACH POST module.exports.createPages = async ({ graphql, actions, reporter }) => { const { createPage } = actions; const postTemplate = path.resolve(‘src/templates/news.js’); const postResult ..

Read more

try { const res = await UserModel.findOne({username: username}) if (res === null) { throw new Error("Your username or password was incorrect USERNAME") } const passwordValid = await bcrypt.compare(password, res.hash); if (!passwordValid) { throw new Error("Your username or password was incorrect PASSWORD") } else { console.log("res is: ", res) const convertBalanceToNum = { …res._doc, balance: res.balance.toString() ..

Read more

I’m trying to set up an apollo server and an error shows up. import { createConnection } from "typeorm"; import { Post } from "./entity/Post"; const express = require("express"); import { buildSchema } from "type-graphql"; import { ApolloServer } from "apollo-server-express"; import { PostResolver } from "./Resolvers/post"; createConnection() .then(async (connection) => { console.log("Inserting a new ..

Read more