The API to serve TechnoServe Coffee Program web app called "My PIMA"
Explain how to get your GraphQL API project up and running. Include instructions on prerequisites, installation, and configuration.
- Install Node.js
- Install PostgreSQL
Provide step-by-step installation instructions. For example:
- Clone this repository:
git clone https://github.com/TechnoServe/my-pima-back.git
- Navigate to the project directory:
cd my-pima-back
- Install dependencies:
npm install
- Configure the environment variables from .env.example (if applicable).
-
Install sequelize-cli globally
npm install -g sequelize-cli
-
Generate migration file
sequelize migration:generate --name migration-name
-
Run migration
sequelize db:migrate
-
Undo migration
sequelize db:migrate:undo --name migration-name
Use apollo studio to test the API
Apollo Studio: [PIMA API documentation] (https://studio.apollographql.com/sandbox/explorer?endpoint=https://api.pima.ink/graphql)
// Sample GraphQL query using Apollo Client
import { ApolloClient, InMemoryCache, gql } from "@apollo/client";
const client = new ApolloClient({
uri: "<https://api.pima.ink/graphql>",
cache: new InMemoryCache(),
});
client
.query({
query: gql`query {
// Your GraphQL query here
}`,
})
.then((result) => console.log(result))
.catch((error) => console.error(error));
- load salesforce users
query LoadSFUsers {
loadSFUsers {
message
status
total_new_users
}
}
- load salesforce projects
query LoadProjects {
loadProjects {
message
status
total_new_projects
}
}
- load salesforce projects roles
query LoadProjectRoles {
loadProjectRoles {
message
status
total_loaded
}
}