-
Notifications
You must be signed in to change notification settings - Fork 4
Outline for the project
Raul Becker edited this page Apr 30, 2018
·
20 revisions
Our course project work consists of separate frontend and backend NodeJS applications.
Files associated with the frontend are found in the path /labtool2.0 and the Dockerfile from the repository root. All files associated with the backend are found under /backend path.
- react-scripts are used for something
- redux-thunk?
- Is a plain NodeJS implementation
- less facepalming than with react-scripts
- Uses Express for application routing into Ruby on Rails alike controllers
- asd
- Sequelize ORM is being used as the database backend with its models.
- asd
- Somewhat Ruby on Rails alike application helpers implemented but differentiating
- /backend/server/helpers/application_helper.js intended to store application wide commonly used functions
- each controller has its own helper which imports functions from application_helpers and exports them along with the functions associated only to the controller.
- perhaps not the best way
- Middlewares located in /backend/app.js and are run before any request is processed
- extractToken: reads the header Authorization and extracts the token and saves it in the request.token variable
- perhaps unnecessary completely since the next function may be the sole consumer of the variable
- authenticate: uses request.token and decodes it with jwt and sets request.authenticated as a json which indicates if the request was "authenticated" or not.
- application_helpers.js has controller_before_auth_check_action() method which checks request.authenticated and and ends request processing with 401 Unauthorized unless authenticated. This method is seen first at any controller action where the user needs to be authenticated.
- better way certainly possible to do e.g. having the whole check and discontinuation of request processing in a middleware.
- extractToken: reads the header Authorization and extracts the token and saves it in the request.token variable
- Admin page /admin path not in interaction with the frontend.
- implemented using PUG layout which is again Ruby on Rails alike having its view template in the path /backend/views/index.pug