Foodventeny is a lightweight web application built to help you succeed in planning your next big event!
Foodventeny leverages technologies such as EJS and Passport.js to serve up web pages quickly and securely.
Foodventeny has a built-in local database created with Postgres. We also use Sequelize, a popular Node.js-based ORM library for security and speed of development.
Foodventeny is built using two Docker containers, one for the database and one for the application itself. Containerizing the app ensures compatibility across all machines, greatly simplifying the installation experience.
Ensure that Docker is installed - Docker.
Clone this repository and run the following command in the terminal:
docker-compose up
Then, simply open up your web browser and move to localhost:3000/
.
Type this command in the console to run tests using the jest library.
npm run test
Foodventeny, a local festival organization, is significantly increasing their number of vendors and requires a technological solution to organize and process applications.
In order to meet growing demands, we need to create a fast and secure web application that will be able to handle concurrent application submissions and allow event organizers a simple way to update user applications. In addition, organizers should be able to create application templates for various purposes related to their event and vendors should be able to submit their own applications using those templates and view their application statuses.
- Organizers can create and manage multiple application types, track submissions and update statuses.
- Allows vendors to submit applications and track their statuses.
- Organizers can dynamically create application template fields to customize templates for different types of vendors.
- Organizers can edit and delete templates.
- Users can edit and delete submitted applications.
- Pagination for GET /apps.
- Add additional unit tests.
Admins can get a list of all submitted applications. Users can get a list of all applications they have submitted.
GET /apps
Users can submit an application.
POST /apps
request.body {
first_name: 'john',
last_name: 'doe',
phone_number: 1231231231,
email: johndoe123@example.com,
vendor_type: 'restaurant',
description: 'I would like to participate in Foodventeny!'
}
Admins can create templates for applications.
POST /template
request.body {
vendor_type: 'restaurant'
}
Lastly, admins can update the status of an application.
PUT /apps/status/:id
request.body {
status: 'approved'
}
This project follows the model-view-controller (or MVC) design pattern. EJS acts as the View element; the template displays information returned from the controller. The Controller consists of the server (express.js), the authentication library (Passport) and the controller classes. They work in tandem to process user input, update the Model, and select the View to present to the user. And finally, the Model consists of the ORM (Sequelize) and the service classes. They handle all of the business logic and manage the application's state (updating the PostgreSQL database).
Express.js is a minimal and flexible Node.js framework that provides a number of features for web applications. It acts as the main server, handling incoming HTTP requests, defining routes, and sending responses back to the client.
EJS (Embedded JavaScript) is a templating engine that is used to generate HTML markup with plain JavaScript. It is used to render dynamic web pages by embedding JavaScript logic directly into HTML.
Passport.js and Express-session are express middlewares used to implement simple and secure authentication. Passport.js supports various authentication strategies, including passport-local
, which enables users to tailor Passport.js to their specific needs. In this case, passport-local
provides a simple username and password authentication that stores data on the session created by Express-session.
PostgreSQL is an open-source relational database system and Sequelize is a promise-based ORM (Object-Relational Mapper). The application uses Sequelize to interact with the PostgreSQL database using JavaScript objects. Using an ORM makes interacting with data simple and more secure.
Docker containers include everything needed to run a piece of software. The application and database run inside separate Docker containers.