This project is a GraphQL API designed to manage users and tasks within an application. It leverages the power of GraphQL to provide a flexible and efficient way to interact with the application's data. The API allows for operations such as querying for users and tasks, finding specific users or tasks by various attributes, and listing all users or tasks.
- User Management: Query for single or multiple users by ID or email. Each user has a unique ID, a name, and a unique email address.
- Task Management: Query for single or multiple tasks by ID, title, or status. Tasks are identifiable by a unique ID and can be filtered by their title or status.
- A server environment capable of running GraphQL.
- Lighthouse - a PHP package that allows you to serve a GraphQL endpoint from your Laravel application.
-
Install Lighthouse: Follow the official Lighthouse documentation to install Lighthouse in your Laravel application.
-
Schema Setup: Place the
schema.graphql
file in your project's designated schema directory (default isgraphql/
in your Laravel project). -
Configure Scalars: The
DateTime
scalar type is used in this schema. Ensure the custom scalar is properly defined in your Lighthouse configuration.
php artisan key:generate
- Start your Laravel server:
php artisan serve
- Access the GraphQL endpoint at the path configured in your Lighthouse settings (default is
/graphql
).
{
user(id: "1") {
id
name
email
}
}
{
tasks(status: "completed") {
id
title
}
}
Contributions are welcome! Please feel free to submit pull requests or open issues to discuss proposed changes or enhancements.
If you need any more corrections or adjustments, let me know!