This is a project to practice GraphQl and Node.js
- typescript
- @apollo/server
- graphql
- type-graphql
- dotenv
- typeorm
- mysql
- bcrypt
- Need to have node.js installed
- Need to have docker installed with docker compose
Run $ docker-compose up -d
Create a .env file at root directory, there's a .env.example to be used as a draft and model.
MYSQL_DATABASE=[MYSQL_DATABASE]
MYSQL_USER=[MYSQL_USER]
MYSQL_PASSWORD=[MYSQL_PASSWORD]
MYSQL_ROOT_PASSWORD=[MYSQL_ROOT_PASSWORD]
MYSQL_PORT=[MYSQL_PORT]
MYSQL_HOST=[MYSQL_HOST]
Run $ npm install
to install dependencies
Run $ npm run start
to compile and start application.
Run $ npm run start
to compile and start application.
Run $ npm run compile
to compile application.
Run $ npm run dev
to start application in watching mode.
scalar DateTimeISO
input AddUserInput {
email: String!
name: String!
password: String!
profileIds: [ID!]!
}
input DeleteUserInput {
email: String
id: ID
}
input SearchUserInput {
id: ID!
}
input SearchUsersInput {
limit: Float!
page: Float!
}
input UpdateUserFilterInput {
email: String
id: ID
}
input UpdateUserInput {
active: Boolean
profileIds: [ID!]
email: String
name: String
password: String
}
type User {
active: Boolean!
createdAt: DateTimeISO!
email: String!
id: ID!
name: String!
profiles: [Profile]!
updatedAt: DateTimeISO!
}
type Mutation {
addUser(data: AddUserInput!): User!
deleteUser(data: DeleteUserInput!): Boolean
updateUser(filter: UpdateUserFilterInput!, user: UpdateUserInput!): User
}
type Query {
user(data: SearchUserInput!): User
users(data: SearchUsersInput!): [User]!
}
- user(data: SearchUserInput!): User
- users(data: SearchUsersInput!): [User]!
- addUser(data: AddUserInput!): User!
- deleteUser(data: DeleteUserInput!): Boolean
- updateUser(filter: UpdateUserFilterInput!, user: UpdateUserInput!): User
input CreateProfileInput {
name: String!
}
input DeleteProfileInput {
id: ID!
}
input SearchProfileInput {
id: ID
name: String
}
input UpdateProfileFilterInput {
id: ID
name: String
}
input UpdateProfileInput {
name: String!
}
type Profile {
createdAt: DateTimeISO!
id: ID!
label: String!
name: String!
updatedAt: DateTimeISO!
}
type Mutation {
createProfile(profile: CreateProfileInput!): Profile!
deleteProfile(filter: DeleteProfileInput!): Boolean
updateProfile(filter: UpdateProfileFilterInput!, profile: UpdateProfileInput!): Profile
}
type Query {
profile(data: SearchProfileInput!): Profile
profiles: [Profile]!
}
- profile(data: SearchProfileInput!): Profile
- profiles: [Profile]!
- createProfile(profile: CreateProfileInput!): Profile!
- deleteProfile(filter: DeleteProfileInput!): Boolean
- updateProfile(filter: UpdateProfileFilterInput!, profile: UpdateProfileInput!): Profile
Run $ docker-compose down
Run $ docker-compose down --rmi all
To update docker images with services changes
Run this commands
1.$ docker-compose down
2.$ docker-compose build
3.$ docker-compose up -d