Skip to content

MuslimShah/express-stater-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express Starter Template with MVC Pattern

This is an Express starter template that implements the Model-View-Controller (MVC) pattern. It includes models, views, controllers, and custom error handlers to help you get started with building your web application quickly and easily.

To use this template, you can clone this repository using Git:

git clone https://github.com/MuslimShah/express-stater-template.git

After cloning the repository, navigate to the project directory and install the dependencies using npm:

cd express-starter-template npm install

Usage

To start the server, run the following command:

npm start

This will start the server on port 3000. You can access the server by navigating to http://localhost:3000 in your web browser.

MVC Pattern

The MVC pattern is a popular design pattern used in web development. It separates the application into three interconnected components: the model, the view, and the controller.

  • Model: Represents the data and business logic of the application.
  • View: Represents the user interface of the application.
  • Controller: Acts as an intermediary between the model and the view, handling user input and updating the model and view accordingly.

In this template, the models directory contains the database schema and models. The views directory contains the HTML templates, while the controllers directory contains the logic for handling HTTP requests and responses.

Error Handlers

Error handling is an important aspect of building robust web applications. This template includes custom error handlers to help you handle errors gracefully.

The errorHandlers directory contains custom error handlers for handling 404 and 500 errors. If a user navigates to a non-existent route, they will receive a 404 error. If there is an internal server error, they will receive a 500 error.

Contributing

Contributions are welcome! If you would like to contribute to this project, please open a pull request.

Releases

No releases published

Packages

No packages published