Skip to content

jnhthomp/node-mvc-boilerplate

 
 

Repository files navigation

Node MVC Boilerplate

JTDEV This is used as a starting point for my MVC node server applications. It serves as a good baseline and will continue to be updated with different useful dependencies and potentially different branches to provide different starting points

How It's Made:

Tech used: javascript nodejs MongoDB postman Express JS This is an express based node server that connects with mongodb for an easy way to begin building and prototyping a server side application quickly. The repository can simply be cloned and provided a .env matching .env-example

Available Endpoints

This boilerplate comes in the form of a todo application to provide some basic test routes for CRUD operations. After ensuring that the application is connecting to MongoDB properly using these routes, the default routes and controllers can be changed as needed to suite the needs of the app or removed entirely if starting from scratch would be better.

  • /
    • GET: Return index/root route
  • /todos
    • GET: Return list of all todos
  • /todos/createTodo
    • POST: Submit a new todo item to the database
  • todos/markComplete
    • PUT: Update a a todo item to mark as complete in the database
  • todos/markIncomplete
    • PUT: Update a a todo item to mark as incomplete in the database
  • todos/deleteTodo
    • DELETE: Remove a todo item from the database

router.delete('/deleteTodo', todosController.deleteTodo)

How to install/use

  1. Create MongoDB account/database
    • Use connect button to get connection string and make note
  2. Create .env file to store connection string and port to use on dev environment
    • See .env-example and follow instructions to replace demo with the db specific username and password
  3. Install server npm dependencies
    • $npm install
  1. To run server in dev environment with nodemon:
    • $npm run dev

Optimizations

Optimizations will be added as new projects are built and preferences/tools are discovered/developed

Lessons Learned

  • Creating Node server applications utilizing MVC architecture
  • Interacting with MongoDB via CRUD actions
  • Utilizing a schema with mongoose to create a relational MongoDB instance
  • Using developer tools such as Nodemon, morgan, and cross-env
  • Dynamically rendering data server side with ejs files

Resources:

Other Examples:

Take a look at other examples from my portfolio

Blog Site W/ Categories and Authentication: https://github.com/jnhthomp/alpha-blog2

Stock Based Social Network: https://github.com/jnhthomp/finance-tracker

Restaurant Web-Based Ordering System: https://github.com/jnhthomp/practice-food-order-app

About

Node MVC pattern boilerplate in the form of a simple todo list app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.9%
  • EJS 14.5%
  • CSS 1.5%
  • Procfile 0.1%