/wab-menu-api-nestjs

Learn how to use NestJS, a Node.js framework powered by TypeScript, to build a secure API

Primary LanguageTypeScript

Developing a Secure API with NestJS

Click here to read the full tutorial

Learn how to build a feature-complete API using NestJS that lets clients perform data operations on resources that describe a restaurant menu. Using TypeScript with Node.js gives you access to optional static type-checking along with robust tooling for large apps and the latest ECMAScript features.

Learn also how to define data models, create a data service, and quickly build modular endpoints. As an option, you can also learn how to secure the API using Auth0. To see your API in action, you’ll use a production client called "WHATABYTE Dashboard", which is inspired by the sleek web player from Spotify.

WHATBYTE Dashboard menu item

Setup

  • Clone repository:
git clone git@github.com:auth0-blog/wab-menu-api-nestjs.git \
nest-restaurant-api \
  • Make the project folder your current directory:
cd nest-restaurant-api
  • Install the project dependencies:
npm i
  • If you haven't set up any Auth0 applications, follow the steps from these tutorial sections to create them:

Set Up API Authorization

Register a Client Application with Auth0

Connect a Client Application With Auth0

  • Create a .env hidden file:
touch .env
  • Populate .env with this:
PORT=7000
AUTH0_DOMAIN="Your Auth0 domain"
AUTH0_AUDIENCE="Your Auth0 audience"
  • Start the Express server:
npm run start:dev

Read on the complete tutorial

If you have any questions or feedback, please contact us through our Community Site for this tutorial.

About Auth0

Auth0, the identity platform for application builders, provides thousands of enterprise customers with a Universal Identity Platform for their web, mobile, IoT, and internal applications. Its extensible platform seamlessly authenticates and secures more than 2.5B logins per month, making it loved by developers and trusted by global enterprises. The company's U.S. headquarters in Bellevue, WA, and additional offices in Buenos Aires, London, Tokyo, Sydney, and Singapore, support its customers that are located in 70+ countries.

For more information, visit https://auth0.com or follow @auth0 on Twitter.