node-starter-app-mysql
A boilerplate for Node.js web applications.
It is based on following libraries and frameworks-
- Express.js
- Ejs template engine
- mongoose
- jQuery
- Semantic UI
- JsonWebToken for authentication
Folder Structure
-
bin: It contains the main file 'www' which starts node server
-
config: All the configurable parameters and credentials
-
data: json data
-
logs: logs dumps here
-
middlewares: All the middlewares defined here
-
models: Sequelize models (database schema)
-
modules: Independent modules used throughout the app are defined here
-
public: All the static resources (js, css, images)
-
routes: All the routes
-
services: These act as middlemen between routes and database. All the database operations are made here.
-
views: Contains HTML and .ejs files used for rendering to frontend
How to install
git clone https://github.com/varunon9/node-starter-app-mongo.git
cd node-starter-app-mongo
npm install
cd public
bower install
- create database 'nodeStarterAppMongo' in MySql
create database nodeStarterAppMongo
- come back to project directory
cd ..
- start app
nodemon bin/www
or node bin/www
- visit localhost:4000 in browser
Naming Conventions
- using camelCase for naming variables, functions in javascript
- using camelCase for naming MySql tables, CSS IDs
- using hyp-hens for naming CSS classes
- using under_scores for naming files and folders
- using UPPERCASE for constants and global variables
- using PascalCase for naming Javascript classes
Coding Conventions
- Line length max 80 characters for Javascript
- Line length max 120 characters for HTML
- Standard JS coding conventions- https://www.w3schools.com/js/js_conventions.asp
Screenshots
Learning Resources
- JavaScript Functions
For query/issues create Github issue or contact: [email protected]