From de1b85c01010a539c1b1eda445f61634246c8016 Mon Sep 17 00:00:00 2001 From: Martin Gontovnikas Date: Fri, 25 Jul 2014 17:08:53 -0700 Subject: [PATCH] Updated nodejs Doc --- docs/new/server-apis/nodejs.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/docs/new/server-apis/nodejs.md b/docs/new/server-apis/nodejs.md index 9b5dff1..9519b2f 100644 --- a/docs/new/server-apis/nodejs.md +++ b/docs/new/server-apis/nodejs.md @@ -4,11 +4,9 @@ lodash: true ##NodeJS -If you're creating a new NodeJS api that you'll use with your <%= configuration.frontend || 'Frontend' %> code, you can [click here to download](https://github.com/auth0/auth0-nodejsapi-sample/archive/master.zip) a seed project that is already configured to use Auth0. + Click here to download a Seed project<% if (account.userName) { %> with your Auth0 account information<% } %> -Then, you just need to specify your Auth0 account configuration in the `.env` file: [https://github.com/auth0/auth0-nodejsapi-sample#running-the-example](https://github.com/auth0/auth0-nodejsapi-sample#running-the-example) - -Otherwise, Please follow the steps below to configure your existing NodeJS app to use it with Auth0. +**Otherwise, Please follow the steps below to configure your existing NodeJS app to use it with Auth0.** ### 1. Add express-jwt dependency @@ -25,7 +23,6 @@ npm install express-jwt --save You need to set the ClientID and ClientSecret in `express-jwt`'s configuration so that it can validate and sign [JWT](https://docs.auth0.com/jwt)s for you. ````js - var http = require('http'); var express = require('express'); var app = express(); var jwt = require('express-jwt'); @@ -41,15 +38,7 @@ You need to set the ClientID and ClientSecret in `express-jwt`'s configuration s Now, you need to specify one or more routes or paths that you want to protect, so that only users with the correct JWT will be able to do the request. ````js -app.configure(function () { - - // ... - - app.use('/api/path-you-want-to-protect', jwtCheck); - - // ... - -}); +app.use('/api/path-you-want-to-protect', jwtCheck); ``` ### 4. You've nailed it.