Simple Express.js & Socket.io Boilerplate.
- Express 4.16
- Mongoose 5.7
- Passport.js with Bcrypt.js
- Login endpoint
- Register endpoint
- Username availability check endpoint
- Logout endpoint
- Socket.io integration for real-time, bidirectional and event-based communication.
- Social login / register integration.
git clone https://github.com/aaron5670/ExpressJS-SocketIO-Boilerplate.git
cd expressjs-socketio-boilerplate
npm install
// Optional: if you want dummy data, then run this seed file
node seed.js
node server.js
The following endpoints are available
url: /api/v1/auth/login
method: POST
This request expects the following body:
{
"username": "jane",
"password": "securepassword1"
}
It will response the client the following object after a successful login:
{
"success": true,
"username": "jane",
"message": "Successful login, welcome!"
}
url: /api/v1/auth/register
method: POST
This request expects the following body:
{
"name": "John Doe",
"username": "john",
"password": "password123"
}
It will response the client the following object after a successful register:
{
"success": true,
"message": "User is successfully registered!"
}
url: /api/v1/auth/username-availability
method: GET
query parameter: username
This request expects a request like:
https://localhost:3005/api/v1/auth/username-availability?username=john
It will response the client the following object after a successful request:
{
"usernameAlreadyInUsage": true
}
url: /api/v1/auth/logout
method: GET
It will response the client the following object after a successful request:
{
"success": true
}