This project is both an oppinionated sample application for efficient use of Node Express, and a starter template for your own projects. This includes all the basics of a web application, tuned for local development and tested on production deployement to Heroku and Docker.
-
Models via Sequelize.
-
Views via Embedded JavaScript.
-
Controllers via an Express Routes convetion.
-
Form Validation via Express Validator and Validator JS.
-
Data Model Migrations via Sequelize Migrations.
This was initially generated using the express command as follows:
$ express --view ejs --git
Unfortunately, it was too bare bones and had some minor issues. Bugs where fixed and the supporting libraries where added via NPM.
$ git clone git@github.com:RobertoMachorro/express_webapp.git
$ npm install
$ DEBUG=express-webapp:* npm start
Try the demo at Heroku.
Fork or branch this project, then change all express-webapp references to your application's name (optional). Now you are ready to add views, controllers, images, etc. Each instance needs its own config/config.json, for database configuration; Copy a starter from config_.json template.
When working with databases, in particular between different environments. It's best to configure the DATABASE_URL environment variable.
[postgresql|mysql]://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
When adding Models and Seeds, make sure you migrate and run seeds as needed.
- This project is a compilation of multiple projects. Care has been taken to standardize as much as possible, but stuff may still be patchy looking.
- Production has been tested in Heroku / AWS with no issues, however, a database enviroment must be prior setup.