update structure and annotations

This commit is contained in:
WieErWill 2022-04-02 08:55:52 +02:00
parent b93f1f770f
commit 439d984f12

View File

@ -3,20 +3,21 @@ This repository show you a simple but powerful way to start up your NodeJS Proje
## Get started ## Get started
1. Clone/Fork this repository to your computer 1. Clone/Fork this repository
2. install all requirements 2. install all requirements
1. node 1. node
2. mysql 2. npm (or yarn)
2. set the config files 3. mysql
1. change "mail.js" credentials 3. set the config files
2. change "database.js" credentials 1. change `config/mail.js` credentials
3. start your development server with "npm run dev" 2. change `config/database.js` credentials
4. feel free to do what you want to do 4. start your development server with `npm run dev`
5. feel free to do what you want to do
## Routing ## Routing
| URL | Method | Desc | | URL | Method | Desc |
| --- | --- | --- | | ----- | ------ | ------------------------ |
| / | GET | Index Site | | / | GET | Index Site |
| / | POST | nothing yet, work on it | | / | POST | nothing yet, work on it |
| / | DELETE | nothing yet, work on it | | / | DELETE | nothing yet, work on it |
@ -25,44 +26,45 @@ This repository show you a simple but powerful way to start up your NodeJS Proje
| /api | GET | Your API starts here | | /api | GET | Your API starts here |
## npm Packages ## npm Packages
Name | Version | Description | Name | Description |
--- | --- | --- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
[body-parser](https://www.npmjs.com/package/body-parser) | ^1.19.0 | Parse incoming request bodies in a middleware before your handlers, available under the req.body property. | [body-parser](https://www.npmjs.com/package/body-parser) | Parse incoming request bodies in a middleware before your handlers, available under the req.body property. |
[connect-flash](https://www.npmjs.com/package/connect-flash) | ^0.1.1 | The flash is a special area of the session used for storing messages | [connect-flash](https://www.npmjs.com/package/connect-flash) | The flash is a special area of the session used for storing messages |
[cookie-parser](https://www.npmjs.com/package/cookie-parser) | ^1.4.5 | Parse Cookie header and populate req.cookies with an object keyed by the cookie names | [cookie-parser](https://www.npmjs.com/package/cookie-parser) | Parse Cookie header and populate req.cookies with an object keyed by the cookie names |
[env-cmd](https://www.npmjs.com/package/env-cmd) | ^10.1.0 | A simple node program for executing commands using an environment from an env file | [env-cmd](https://www.npmjs.com/package/env-cmd) | A simple node program for executing commands using an environment from an env file |
[express](https://www.npmjs.com/package/express) | ^4.17.1 | Fast, unopinionated, minimalist web framework for node | [express](https://www.npmjs.com/package/express) | Fast, unopinionated, minimalist web framework for node |
[express-session](https://www.npmjs.com/package/express-session) | ^1.17.0 | Create a session middleware | [express-session](https://www.npmjs.com/package/express-session) | Create a session middleware |
[method-override](https://www.npmjs.com/package/method-override) | ^3.0.0 | Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it | [method-override](https://www.npmjs.com/package/method-override) | Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it |
[morgan](https://www.npmjs.com/package/morgan) | ^1.10.0 | HTTP request logger middleware for node.js | [morgan](https://www.npmjs.com/package/morgan) | HTTP request logger middleware for node.js |
[mysql](https://www.npmjs.com/package/mysql) | ^2.18.1 | This is a node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed. | [mysql](https://www.npmjs.com/package/mysql) | This is a node.js driver for mysql. It is written in JavaScript, does not require compiling, and is 100% MIT licensed. |
[nodemailer](https://www.npmjs.com/package/nodemailer) | ^6.4.6 | Send e-mails from Node.js easy as cake! | [nodemailer](https://www.npmjs.com/package/nodemailer) | Send e-mails from Node.js easy as cake! |
[nodemon](https://www.npmjs.com/package/nodemon) | ^2.0.2 | nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected. | [nodemon](https://www.npmjs.com/package/nodemon) | nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected. |
[pug](https://www.npmjs.com/package/pug) | ^2.0.4 | Pug is a high performance template engine heavily influenced by Haml and implemented with JavaScript for Node.js and browsers | [pug](https://www.npmjs.com/package/pug) | Pug is a high performance template engine heavily influenced by Haml and implemented with JavaScript for Node.js and browsers |
## Folder Overview ## Directory Overview
- config: all your apps configuration files for databases, connections and other ```
config: all your apps configuration files for databases, connections and other
- .env-cmdrc.json: all environment variables for your servers - .env-cmdrc.json: all environment variables for your servers
- database.js: your database connections and table overview - database.js: your database connections and table configuration
- db-test.js: test your database connection with this js - db-test.js: test your database connection with this
- mail.js: your mail connection - mail.js: your mail configuration
- robots.js: get a robot.txt file with this script - robots.js: creates a custom robot.txt file
- sitemap-generator.js: get a sitemap with this script - sitemap-generator.js: creates a custom sitemap
- public: all files your Guests can access directly public: all files your Guests can access directly
- css: your css files - css: your css files
- main.css: a starter .css file - main.css: a starter .css file
- img: all your images - img: all your images
- js: all your JS scripts - js: all your JS scripts
- routes: whereever you are routing, keep it simple and structured routes: wherever you are routing, keep it simple and structured
- api.js: here every /api requests goes - api.js: here goes every "/api" request
- index.js: here every / reqest goes - index.js: here goes every "/" request
- middlewear.js: use middlewear for repeating actions across multiple routes like authorisation/authentication - middlewear.js: use middlewear for repeating actions across multiple routes like authorisation/authentication
- views: here lies what your guests can later see in pug.js views: contains all template files for clients view
- index: all files for index routes - index: all files for index routes
- index.pug: the index routes view - index.pug: the index routes view
- layout.pug: make it easy with a standarized layout for all your files - layout.pug: make it easy with a standarized layout for all your files
- app.js: entry file to start everything up app.js: entry file to start everything up
- gitignore: ignore some files in your git repository that don't matter .gitignore: ignore some files in your repository that don't matter or don't need to be copied everytime
- package.json: overview and scripts for your packages package.json: overview and scripts for your packages
- package-lock.json readme.md: log everything to never forget anything
- readme.md: log everything to never forget anything ```