Skip to content

francesjgonzales/100yearsofnursing

Repository files navigation

100yearsofnursing

About the project

  1. Install all dependencies npm init then npm install
  2. Used MVC architecture
  3. Used Bootstrap as CSS framework
  4. Used Mongoose for database
  5. Used Axios for data fetching
  6. Used Express JS as Node JS framework for handling routes, request and response
  7. HBS for compiling HTML templates
  8. SECURING THE SERVER Used Error Middleware as callback function that can detect request and response when called in from client to HTTP server. This secures error paths that can be hidden in browser and customized by using the callback function written.

Testing Error-Handling Middleware

  1. Import the function app.use(errorMiddleware) in app.js and add a Throw new Error('fake error message') in any of the routes where the path selected can be used to test in Postman.
  2. Add the error messages with require express-async-error in controller. (eg. in albertaController.js, add the Throw new Error in catch error)
  3. (Documentation)[https://expressjs.com/en/guide/using-middleware.html#middleware.error-handling]

Dependencies

Json-server database

  • Before deployment, add json-server in package-json to connect to local database db.json "scripts": { "start": "nodemon src/app.js -e html,hs,hbs **&& json-server --watch db.json --port 3000**" }

Deployment

  • Deployed in Railway using private github repository
  • Change NODE_ENV status to 'production' before deployment

Axios

[https://blog.logrocket.com/understanding-axios-get-requests/]

Git

Create new branch - git checkout -b <new-branch>

Development

  1. Package.json Add script "start": "nodemon src/app.js -e html,hs,hbs reload",
  2. app.js comment or delete const reload = require('reload')
  3. .env change production to development

About

A static website using Mongoose, Express.js and hbs

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published