在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):watscho/express-graphql-mongodb-boilerplate开源软件地址(OpenSource Url):https://github.com/watscho/express-graphql-mongodb-boilerplate开源编程语言(OpenSource Language):JavaScript 82.9%开源软件介绍(OpenSource Introduction):express-graphql-mongodb-boilerplateAlso express-mongodb-rest-api-boilerplate - REST-API Boilerplate Authentication from scratchSign In, Sign Up, Reset Password, Change Password, Update UserE-mail verification, Multi language, Redis for token blacklistingPackage list
RedisMac (using homebrew): brew install redis Linux: sudo apt-get install redis-server yarn - workspaces with lernaFirst, we usecd workspaces/api COPY .env.example to .envcp .env.example .env Note: I highly recommend installing nodemon. nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for API Startyarn start
yarn start:local # with nodemon Docker composedocker-compose up -d --build
docker-compose -f docker-compose.dev.yml up --build # with nodemon ESlint Startyarn lint
yarn lint:write # with prefix --fix API Structure├─ src
│ ├─ graphql
│ │ ├─ index.js
│ │ ├─ schema.js
│ │ └─ types.js
│ ├─ i18next
│ │ ├─ locales
│ │ │ ├─ en.json
│ │ │ └─ ge.json
│ │ └─ index.js
│ ├─ middleware
│ │ ├─ authentication.js
│ │ ├─ authMiddleware.js
│ │ └─ index.js
│ ├─ module
│ │ ├─ auth
│ │ │ ├─ mail
│ │ │ │ ├─ index.js
│ │ │ │ └─ userMail.js
│ │ │ ├─ service
│ │ │ │ ├─ index.js
│ │ │ │ └─ userService.js
│ │ │ ├─ index.js
│ │ │ ├─ resolvers.js
│ │ │ ├─ types.js
│ │ │ └─ user.js
│ │ └─ index.js
│ ├─ service
│ │ ├─ logger.js
│ │ └─ nodemailer.js
│ ├─ validator
│ │ ├─ index.js
│ │ └─ userValidator.js
│ ├─ view
│ │ └─ template
│ │ ├─ reset-password
│ │ │ └─ html.ejs
│ │ ├─ verify
│ │ │ └─ html.ejs
│ │ └─ verify-request
│ │ └─ html.ejs
│ ├─ index.js
│ ├─ mongoose.js
│ └─ redis.js
├─ .dockerignore
├─ .env.example
├─ .eslintignore
├─ .eslint
├─ .gitignore
├─ Dockerfile
├─ Dockerfile.dev
├─ LICENSE
├─ README.md
├─ docker-compose.dev.yml
├─ docker-compose.yml
└─ package.json Note: To continue development, you should learn about graphql-compose - this is the library that I use to write the API, you can read about it at the link: docs Queriesquery user {
user {
_id
email
firstName
lastName
locale
account {
verification {
verified
}
}
updatedAt
createdAt
}
} Mutationsmutation signIn($email: String!, $password: String!) {
signIn(email: $email, password: $password) {
accessToken
}
}
mutation signUp($email: String!, $password: String!) {
signUp(email: $email, password: $password) {
accessToken
}
}
mutation logout {
logout {
succeed
}
}
mutation verifyRequest {
verifyRequest {
succeed
}
}
mutation verify($token: String!) {
verify(token: $token) {
accessToken
}
}
mutation resetPassword($email: String!) {
resetPassword(email: $email) {
succeed
}
}
mutation newPassword($token: String!, $newPassword: String!) {
newPassword(token: $token, newPassword: $newPassword) {
accessToken
}
}
mutation changePassword($currentPassword: String!, $newPassword: String!) {
changePassword(currentPassword: $currentPassword, newPassword: $newPassword) {
succeed
}
}
mutation updateUser($email: String!, $firstName: String!, $lastName: String!) {
updateUser(email: $email, firstName: $firstName, lastName: $lastName) {
_id
email
firstName
lastName
locale
account {
verification {
verified
}
}
updatedAt
createdAt
}
}
mutation switchLocale($locale: Locale!) {
switchLocale(locale: $locale) {
_id
email
firstName
lastName
locale
account {
verification {
verified
}
}
updatedAt
createdAt
}
} Note: For any question issues LicenseThis project is an open-source with an MIT License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论