0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

MVC の構成をアレンジしてみた

Last updated at Posted at 2021-12-18

MVC に救いの手を

一般的な MVC 構成

app
├── controllers
│   ├── accountController.js
│   ├── apiController.js
│   ├── authController.js
│   ├── controller.js
│   ├── templateController.js
│   ├── topController.js
│   └── userController.js
├── index.js
├── models
│   ├── auth.js
│   └── user.js
├── routes
│   ├── accountRoute.js
│   ├── apiRoute.js
│   ├── authRoute.js
│   ├── route.js
│   ├── templateRoute.js
│   ├── topRoute.js
│   └── userRoute.js
├── services
│   ├── accountService.js
│   ├── apiService.js
│   ├── authService.js
│   ├── service.js
│   ├── templateService.js
│   ├── topService.js
│   └── userService.js
├── validations
│   ├── accountValidation.js
│   ├── apiValidation.js
│   ├── authValidation.js
│   └── userValidation.js
└── views
    ├── account
    │   └── password.ejs
    ├── auth
    │   └── login.ejs
    ├── error
    │   └── default.ejs
    ├── index.ejs
    ├── menu
    │   ├── body.ejs
    │   └── head.ejs
    ├── partial
    │   └── header.ejs
    └── user
        ├── index.ejs
        ├── register.ejs
        └── reset.ejs

機能を移植しにくいので構成を変更

app
├── account
│   ├── controller.js
│   ├── route.js
│   ├── service.js
│   └── validation.js
├── api
│   ├── controller.js
│   ├── route.js
│   ├── service.js
│   └── validation.js
├── auth
│   ├── controller.js
│   ├── model.js
│   ├── route.js
│   ├── service.js
│   └── validation.js
├── controller.js
├── index.js
├── route.js
├── routes
├── service.js
├── template
│   ├── controller.js
│   ├── route.js
│   └── service.js
├── top
│   ├── controller.js
│   ├── route.js
│   └── service.js
├── user
│   ├── controller.js
│   ├── model.js
│   ├── route.js
│   ├── service.js
│   └── validation.js
└── views
    ├── account
    │   └── password.ejs
    ├── auth
    │   └── login.ejs
    ├── error
    │   └── default.ejs
    ├── index.ejs
    ├── menu
    │   ├── body.ejs
    │   └── head.ejs
    ├── partial
    │   └── header.ejs
    └── user
        ├── index.ejs
        ├── register.ejs
        └── reset.ejs

機能の移植が容易になって嬉しい

コードサンプル

https://github.com/jobscale/tanpo.git
https://github.com/jobscale/jsxjp.git

デモサイト

https://jsx.jp
https://tanpo.jsx.jp

次の目標

各機能を npm モジュール化してみます

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?