Issue: The body must be in string format. Current value: { resolvers: [[function HelloResolver]], validate: false } is encountered while utilizing Type-graphql in conjunction with apollo-server-express

I've been closely following Ben Awad's full-stack tutorial, and everything was going smoothly until I encountered an error while adding a resolver to the schema. Despite using graphql 15.5.1, type-graphql 1.1.1, and apollo-server-express version 2.25.2, my code resulted in the error mentioned above. Here is a snippet of my code:

import {Query, Resolver} from "type-graphql";

@Resolver()
export class HelloResolver {
    @Query(() => Number)
    hello() {
        return 5;
    }
}

import { ApolloServer } from "apollo-server-express";
import { buildSchema } from "graphql";
import {HelloResolver} from "./resolvers/hello";

const express = require('express');
const PORT : number = Number(process.env.PORT) || 3000;

const main = async () => {
    const apollo = new ApolloServer({
        schema: await buildSchema({
            // ERROR DUE TO LINE BELOW
            resolvers: [HelloResolver],
            validate: false,
        }),
    });

    apollo.applyMiddleware({ app });

    app.listen(PORT, () => {
        console.log(`Listening on port ${PORT}...`);
    });
}

main().catch((e) => {
    console.error(e);
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Generate a circular shape wherever the mouse is moved

I'm currently working on implementing a custom mouse trail using temporary divs. These divs are supposed to appear at the location of the mouse and then fade out after a short period. However, I've run into an issue where the divs only appear at ...

Maximizing the benefits of server side rendering

My curiosity about Server Side Rendering led me to discover a framework called nextjs during my Google searches. After giving it a try, I must say that I found it quite impressive. Now, I am determined to delve deeper into SSR by taking a dedicated course. ...

Unique ActionBar design for my NativeScript-Vue application

I'm currently working on customizing the ActionBar for my nativescript-vue app. I have implemented FlexBoxLayout within the ActionBar, but I am facing an issue where the icon and title of the bar are not aligning to the left as intended; instead, they ...

Changing URLs dynamically | Manipulating browser history in HTML5

I am in the process of creating a basic server to serve just one HTML page where all the backend functionality is handled by Angular. I have successfully implemented HTML5 history mode which allows for navigation through standard URLs. However, in order t ...

Mastering the integration of TypeScript with vue-i18n and arrays

We have developed a basic landing page that showcases countries specified in a Vue-i18n language.json file. While the functionality is working well, we are encountering the following TypeScript errors: [vue-tsc] Property 'code' does not exist o ...

The name 'keyof' is nowhere to be found

I am attempting to utilize the keyof keyword in TypeScript, but I am encountering an issue where it is not being found. I am currently using TypeScript version 3.5.2 with Angular version 7.2.2. Thank you in advance. export class Functions { static Lis ...

Swapping out content in an HTML document using JSON data

Currently, I am developing a JavaScript script to achieve the following tasks: Retrieve and interpret data from a JSON file Access an HTML file that serves as a template Substitute elements in the HTML file with corresponding elements from the JSON file ...

Strategies for reversing strings in JavaScript without relying on built-in functions

Are you wondering how to reverse the words in a string without using the split, reverse, and join functions? Here is the problem: You need to reverse the words in a string. For example, if the input is "Hello World," the output should be "World Hello." ...

Can a single value be stored in a table using a radio button?

I have created an HTML table that is dynamically generated from a database. I am using a for loop to populate the table. However, I am facing an issue where each radio button in the table holds only one value. What I actually want is for each row to have ...

What is the best approach to creating DOM elements in AngularJS?

My controller contains data with various actions and different numbers of parameters: $scope.actions = [ {name : 'rotate', r : '30'}, {name : 'translate', x : '10', y : '10'}, {name : 'scale', ...

Leveraging event listeners in conjunction with React's useEffect function

Check out the code example on Code Sandbox here Hey there, I'm trying to implement a feature where clicking a button inside a container displays a box. I've set up an event listener so that when you move your mouse outside the container, the box ...

How to retrieve the default type returned by a function using a custom TypeMap

I have a function that returns a promise with a type provided by generics. const api = <Model>(url: string) => Promise<Model> Currently, I always need to set the type of the returned data. const data = await api<{id: string, name: string ...

Conceal the initial 6 characters with JavaScript before adding them to a list

I am implementing a search form that retrieves account numbers, full names, and SSNs when users search by name. The data is handled using Ajax to POST the form, and upon return, a list is built and displayed on the screen within a div. I'm interested ...

Mastering the Art of Defining JavaScript Classes in React-Native

In my React Native project, I am faced with a situation where I need to create a new class: class customClass { email: string; name: string; constructor() { setUser(fbid: string, token: string): boolean { To keep things organized, I decide ...

Having trouble with Vue component registration repeatedly failing

Currently, I am working on a front-end project using [THIS VUE TEMPLATE][https://www.creative-tim.com/product/vue-material-dashboard-pro] The issue I am facing involves trying to register a component locally and encountering the following error: "1 ...

Angular 7: struggling to locate the type declaration file

Everything seemed to be working fine with my project yesterday, but today I ran into an issue right after installing the ngx-pagination module: ERROR in src/app/views/dashboard/step1/step1.component.ts(1,23): error TS2688: Cannot find type definition ...

The Unusual Behavior of Typescript Partial Interfaces

While reviewing the code in a repository I am currently working on, I stumbled upon something that seemed completely incorrect. Here is a snippet of what caught my attention. interface Car { make: string model: string } type SomeType = Partial<Car& ...

Issue with importing CSS/SASS into Vue Cli 3 Typescript within the <script> block

Recently, I created a new Vue app using TypeScript with Vue Cli 3. However, when attempting to import CSS or Sass into my TypeScript file, I encountered the following issue: import * as sassStyles from '@/assets/sass/my.module.scss'; This re ...

Exploring deep within JSON data using jQuery or Javascript

I have a substantial JSON file with nested data that I utilize to populate a treeview. My goal is to search through this treeview's data using text input and retrieve all matching nodes along with their parent nodes to maintain the structure of the tr ...

What are some methods to boost height in the opposite direction?

I'm looking for a way to make this div fold from top to bottom. How can I achieve this effect without the height increasing abruptly? var box = document.getElementById("box"); box.onmouseover = function(){ box.className = "expand"; } box.o ...