O'Reilly logo

Web Application Development with MEAN by Robert Onodi, Adrian Mejia, Amos Q. Haviv

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The company backend module

We are going to implement our first backend module for our application. This module will handle everything that is related to a company.

The company model

We are going to add a simple but interesting functionality to the company model, which will create a so-called slug from the company name. A slug, in our context, is generated from the name of the company to be accepted as a valid URL. It will be used to reference the company in a meaningful way. For example, if we have a company named Your Awesome Company in the system, the resulting slug will be your-awesome-company.

To generate the slug, we'll implement a simple helper function so that we can reuse it later if necessary. Create a file called app/helpers/common.js

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required