HexSchool node.js live course teamwork practice.
Node.js: v14.19.1
Install packages:
npm install
Setting Environment Variables
cp sample.env config.env
Run Service:
npm start
Run with hot reload (nodemon):
npm run dev
Run development mode:
npm start:dev
Run production mode:
npm start:prod
Generate Swagger Docs (use Swagger-Autogen):
npm run swagger
- NoSQL database: MongoDB object data modeling using Mongoose
- Authentication and authorization: using passport and jsonwebtoken
- Validation: request data validation using express-validator
- Error handling: centralized error handling mechanism
- API documentation: with swagger-autogen and swagger-ui-express
- Dependency management: with Npm
- Environment variables: using dotenv
- CORS: Cross-Origin Resource-Sharing enabled using cors
- WebSocket: Realtime chat using socket.io
- File Upload: upload files with Multer and upload images to imgur using axios
- Mail Service: send emails using nodemailer
The environment variables sample can be found in the sample.env
file. Please copy it and named as config.env
. They come with these default values:
# mongodb
DATABASE_URL=
DATABASE_PASSWORD=
# upload images to imgur
IMGUR_ACCESS_TOKEN=
IMGUR_ACCESS_ALBUM=
# jwt secret key
JWT_SECRET=
# jwt token efficient days
JWT_EXPIRES_DAY=
# email service can set with other services or using SMTP server
GMAIL_USERNAME=
GMAIL_PASSWORD=
GOOGLE_REFRESH_TOKEN=
# sign in with google
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
# sign in with facebook
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
# sign in with discord
DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=