A boilerplate for Node.js, MongoDB & GraphQL applications.
I started this project to simplify and make it ease of use. I also tried to make it as generic and reusable as possible to cover most use cases of GraphQL apps, without being too specific.
xcode-select --install
)sudo apt-get install build-essential
sudo dnf groupinstall "Development Tools"
sudo zypper install --type pattern devel_basis
The easiest way to get started is to clone the repository:
# Get the latest snapshot
git clone --depth=1 https://github.com/ailoitte/node-mongodb-graphql-starter.git myproject
# Change directory
cd myproject
# Install NPM dependencies
npm install
# Then simply start your app
node app.js
Note: I highly recommend installing Nodemon.It watches for any changes in your node.js app and automatically restarts theserver. Once installed, instead of node app.js
use nodemon app.js
. It willsave you a lot of time in the long run, because you won't need to manuallyrestart the server each time you make a small change in code. To install, runsudo npm install -g nodemon
.
Package | Description |
---|---|
async | Utility library that provides asynchronous control flow. |
bcrypt-nodejs | Library for hashing and salting user passwords. |
connect-mongo | MongoDB session store for Express. |
dotenv | Loads environment variables from .env file. |
express | Node.js web framework. |
body-parser | Express 4 middleware. |
morgan | Express 4 middleware. |
mongoose | MongoDB ODM. |
nodemailer | Node.js library for sending emails. |
request | Simplified HTTP request library. |
lodash | Handy JavaScript utilities library. |
validator | Used in conjunction with express-validator. |
jsonwebtoken | An implementation of JSON Web Tokens. |
mongoose-paginate | MongoDB mongoose pagination |
moment | JS date library- parsing,validating,manipulating,andformatting dates. |
mime | Comprehensive MIME type mapping API based on mime-db module. |
firebase-admin | Push notification |
aws-sdk | AWS client SDK |
multer-s3 | Upload multipart to S3 |
winston | async logging library |
cron | Cron job |
mutation {
addUser(name: "Sunil Kumar", email: "sunilkumar707@yahoo.in", mobileNumber:"8867371492", password: "123567"){
id
name
email
mobileNumber
}
}
mutation {
updateUser(name: "Ravi Sanker"){
id
name
email
mobileNumber
}
}
mutation {
loginUser(mobileNumber: "8867371492", password:"1234567") {
id
token
name
email
}
}
mutation {
addUserAddress(street: ["s1", "s2"],
city:"Dehradun",
countryId: "IN",
addressType: "home",
postcode:"23455"
) {
id
street
city
countryId
landmark
locality
addressType
postcode
}
}
mutation {
updateUserAddress(id: "59e4d803d3528728b99b3c53",
street: ["Nesh", "Indra Road"],
city:"Dehradun",
countryId: "IN",
addressType: "home",
postcode:"234551"
) {
id
street
city
countryId
landmark
locality
addressType
postcode
}
}
mutation {
deleteUserAddress(
id: "59e4dc6b875e8829539b20d7"
){
message
}
}
query {
me{
address{
street
city
}
}
}
query {
userAddress(id: "59e4d803d3528728b99b3c53"){
id
city
street
countryId
}
}
}
一、初始化项目及安装一些包 1、官网克隆种子文件 $ git clone https://github.com/nestjs/typescript-starter.git project $ cd project $ npm install 2、安装graphql包及mongoose包(安装包后可能会报错,需要重新安装ts-node) $ npm install --save @nestjs/mo
GraphQL Server Boilerplates for Node.js Bootstrap your GraphQL server within seconds GraphQL boilerplates provide the perfect foundation for your GraphQL server, no matter if you're just getting start
graphql-to-mongodb If you want to grant your Nodejs GraphQL service a whole lot of the power of the MongoDb database standing behind it with very little hassle, you've come to the right place! Example
koa-graphql-mongodb is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial. koa-graphql-mongodb Tutorial how to set up koa with graphql and mongodb
GraphQL MongoDB Server A server boilerplate using GraphQL and MongoDB. Introduction This is a server boilerplate using GraphQL and MongoDB. Support subscriptions using GraphQL Yoga. Getting started Cl
Node.js Express API with TypeScript 4 Node.js Express API with TypeScript 4. Supports MongoDBSee node-express-fast-progress if you need vanilla JS Description This generator will help you to build you
Node.js Express & MongoDB: CRUD Rest APIs For more detail, please visit: Node.js, Express & MongoDb: Build a CRUD Rest Api example Server side Pagination in Node.js with MongoDB and Mongoose Security: