GraphQL API Back-end Repository for School Managment App (TypeScript, Node & MongoDB).
# setup
$ npm install- Install MongoDB and add a
schooldatabase on your local MongoDB Server. To use MongoDB Atlas instead of local database connection, please replace the URI frommongodb://localhost/schoolto your Atlas connection URL atsrc/type-orm.config.ts - Run one of the below commands, preferably
start:dev - Visit GraphQL Playground http://localhost:3000/graphql to run the API. Try running sample queries from
sample-queriesfolder.
# development
$ npm run start
# watch mode
$ npm run start:devCurrent GraphQL API Schema looks like this:
input AddStudentsToLessonInput {
lessonId: ID!
studentIds: [ID!]!
}
input CreateLessonInput {
name: String!
startDate: String!
endDate: String!
students: [ID!] = []
}
input CreateStudentInput {
firstName: String!
lastName: String!
}
type Lesson {
id: ID!
name: String!
startDate: String!
endDate: String!
students: [Student!]!
}
type Mutation {
createLesson(createLessonInput: CreateLessonInput!): Lesson!
addStudentsToLesson(
addStudentsToLessonInput: AddStudentsToLessonInput!
): Lesson!
createStudent(createStudentInput: CreateStudentInput!): Student!
}
type Query {
lessons: [Lesson!]!
lesson(id: String!): Lesson!
students: [Student!]!
student(id: String!): Student!
}
type Student {
id: ID!
firstName: String!
lastName: String!
}