Skip to content

FreeTemplate/websocket-express-template-nodejs

Repository files navigation

English | 中文

websocket-express-template-nodejs

This project provides a template for setting up a Node.js application with Express and WebSockets. It's designed to give developers a quick start when building real-time web applications.

Features

  • Express Setup: Pre-configured Express server with routes, making it easier to set up APIs or serve web pages.
  • WebSocket Integration: Built-in WebSocket server setup that integrates seamlessly with the Express server.
  • Event Management: Structured event handling mechanism using shared event handlers.
  • Example Routes: Sample API routes (/api/post and /api/get) are provided to demonstrate request handling.
  • Modular Structure: Organized folder and file structure, promoting best practices and easier scalability.

Getting Started

  1. Installation: Clone the repository and run npm install to install all the required dependencies.
  2. Starting the Server: Use the command npm start to launch the application.
  3. Connect via WebSocket: The WebSocket server listens on the same port as the Express server. Connect using any WebSocket client to start real-time communication.

How to Add New Events

For a detailed guide on how to integrate and manage new events in this template, refer to the How to Add New Events Guide.

Contribution

Feel free to fork this project, submit PRs and make improvements. Your contributions are welcome!

License

This project is licensed under the MIT License. Refer to the LICENSE file for more details.

Releases

No releases published

Packages

No packages published