mvc-node-express
Version:
MVC framework for express js
169 lines (126 loc) • 5.09 kB
Markdown

# mvc-node-express
modern node js and express framework in MVC architecture
if you are work with php/laravel framework so this is
great because you know this framework architecture
# install :hammer:
you can do this with 2 ways:<br/>
<span style="color:red">1 - download project from [github](https://github.com/llaravell/mvc-node-express)</span><br/>
<span style="color:blue">2 - download project from [gitlab](https://gitlab.com/llaravell/mvc-node-express)</span><br/>
<span style="color:greenyellow">3 - use [NPM](https://www.npmjs.com/package/mvc-node-express)<br/></span>
i'll explain about installing with npm
for that first you must create a folder and run:
```
npm init
```
after that some question will asking from your application
answer them and after that run :
```
npm i mvc-node-express
```
after that if you using Windows please add this line to your package.json in script field
```
"build":"move node_modules/mvc-node-express ./ && rmdir /s node_modules && Del package-lock.json && Del package.json"
```
or if you use linux/mac OS add this line:
```
"build":"mv node_modules/mvc-node-express ./ && rm -r node_modules && rm package-lock.json && rm package.json"
```
after that you save this and run:
```
npm run build
```
if you use windows :<br/>
one question ask from you and you must type <span style="color:red;font-weight:bolder">y</span> enter<br/>
after that you can see mvc-node-express folder insted
of your other files enter to that and run:
```
npm install
```
for installing dependencies and thats it<br/>
<span style="color:orange">congratulations</span> :wine_glass: :wine_glass:<br/>
lets look at this framework architecture
|---app<br/>
| |---Controllers<br/>
| | |---Auth<br/>
| |---Middleware<br/>
| | |---Auth<br/>
| |---Models<br/>
|<br/>
|<br/>
|---public<br/>
| |---css<br/>
| |---fonts<br/>
| |---images<br/>
| |---img<br/>
| |---js<br/>
| |---scss<br/>
| |---vendor<br/>
|<br/>
|<br/>
|---routes<br/>
|<br/>
|<br/>
|---views<br/>
|<br/>
|<br/>
|---.gitignore<br/>
|<br/>
|---package-lock.json<br/>
|<br/>
|---package.json<br/>
|<br/>
|---server.js<br/>
## [app](#app)
this folder conatins 3 subfolders:
#### [Controllers](#Controllers)
this folder is used to place any Controller you want in your application
this folder has a subfolder with Auth name that contains Controllers
used in register/login
#### [Middleware](#Middleware)
this folder is used to place any Middleware you want in your application
this folder has a subfolder with Auth name that contains Middleware
used in register/login
#### [Models](#Models)
this folder is used to place any Models you want in your application
by default we put User Model in it that used for Auth system
## [public](#public)
this folder is a place to hold static files like css,js,images,...
every static file you need put in your project you must put it
in this folder
## [routes](#routes)
this folder contain some files [router.js, requests.js, api.js]
#### [router.js](#router)
this file contain any route in your application Auth routes added by Default
validation filters are comming in this file with an array but catching errors
#### [requests.js](#request)
this file contain a class that has some methods for sending api request
to another server this class added in both router and api files you can
use it by typing Request
#### [api.js](#api)
this file contains any route for send data with api for another platforms
passing to [Middleware](#middleware)
## [views](#views)
this folder contains any view file that used in your project
default engine of this framework is PUG engine
## [server](#server)
server.js file contains codes that you need to start your server
the default port after start the application is 800
you can start your server in developer mode with:
```
npm run dev
```
or you can run application in production mode by:
```
npm run production
```
after that you can see your application in:
```
http://localhost:800
```
# github
github page : [mvc-node-express](https://github.com/llaravell/mvc-node-express)
# gitlab
gitlab page : [mvc-node-express](https://gitlab.com/llaravell/mvc-node-express)
# NPM
NPM page : [mvc-node-express](https://www.npmjs.com/package/mvc-node-express)