dxtaner / Movie-App-Graphql

Movie-App-Graphql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Express GraphQL Server with Cron

This project sets up an Express server with GraphQL integration and cron jobs for periodic tasks. It utilizes Node.js, Express.js, GraphQL, and Cron.

Features

  • GraphQL API: Exposes a GraphQL API endpoint for querying and mutating data.
  • Cron Jobs: Configures cron jobs for executing periodic tasks.
  • Database Connectivity: Establishes a connection to the database.
  • CORS: Implements Cross-Origin Resource Sharing for handling requests from different origins.

Installation

  1. Clone the repository:

    git clone

  2. Install dependencies:

    npm install

  3. Set up environment variables:

Create a .env file in the root directory and specify the required environment variables:

PORT=5000
    DATABASE_URL=<your-database-url>

Usage

  1. Start the server:

    npm start

The server will be running on http://localhost:5000 by default.

  1. Access the GraphQL Playground:

Open a web browser and navigate to http://localhost:5000/graphql to access the GraphQL Playground. Here, you can interact with the GraphQL API, explore the schema, and execute queries and mutations.

Configuration

  • Port: You can specify a custom port by setting the PORT environment variable.
  • Database: Update the DATABASE_URL environment variable with your database connection URL.
  • Cron Jobs: Define your cron job configurations in the cron.js file.

Folder Structure

  • schema/: Contains the GraphQL schema definitions.
  • helpers/: Includes helper functions, such as database connection setup.
  • cron.js: Configures cron jobs.
  • server.js: Entry point for the Express server.

Dependencies

  • express: Web framework for Node.js.
  • express-graphql: Middleware for integrating GraphQL with Express.
  • cors: Middleware for enabling Cross-Origin Resource Sharing.
  • cron: Library for scheduling cron jobs.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

License

MIT License

About

Movie-App-Graphql


Languages

Language:JavaScript 100.0%