This is a free online GraphQL API for providing fake and reliable data for testing and prototyping. It's built with NodeJS, GraphQL, TypeScript, MongoDB and Prisma (see demo documentation here).
The API currently returns the top 45 most popular and none-editable actores and actresses. See demo below:
Feel free to add, edit, or delete your own celebrities as you wish.
You'll need to set up a MongoDB that supports replica set operations. For example, you can use MongoDB Atlas, see more details here.
Create a .env
file in the project's root directory, and add the database URL as described in .env.example
file.
Run yarn
to install Node dependencies, and yarn prisma generate
to generate Prisma Client, then:
Open http://localhost:4000/graphql to view it in the browser.
The is the GraphQL playground page used for testing locally, where you can also find info about the Schema, Mutations, Queries, etc.
query {
celebrities {
id
name
bio
dateOfBirth
birthPlace
photoUrl
editable
}
}
See more API operations
You can retrieve a single celebrity by passing the id:
query {
celebrity(id: "__CELEBRITY_ID__") {
id
...
}
}
This mutation creates a new celebrity by passing the celebrity object:
mutation {
createCelebrity(celebrity: {name: "__NAME__", bio: "__BIO__", dateOfBirth: "__DATE_OF_BIRTH__", birthPlace: "__BIRTH_PLACE__", photoUrl: "__PHOTO_URL__", editable: "__EDITABLE__"}) {
id
...
}
}
This mutation updates an existing celebrity by passing the id along with the properties to update:
mutation {
updateCelebrity(celebrity: {id: "__ID__", name: "__NAME__", bio: "__BIO__", dateOfBirth: "__DATE_OF_BIRTH__", birthPlace: "__BIRTH_PLACE__", photoUrl: "__PHOTO_URL__"}) {
id
...
}
}
This mutation deletes an existing celebrity by passing the id:
mutation {
deleteCelebrity(id: "__ID__") {
id
...
}
}
This mutation deletes all existing celebrities:
mutation {
deleteAllCelebrities {
count
}
}
This runs all unit tests locally.