var user = faker.helpers.userCard(); user.avatar = faker.image.avatar();
The library changed the signature of the faker object.
Creating the basic node server to serve up random users via API endpoints.
This is "Authentication with AngularJS, Getting it Right with JWT." That's pronounced "Jot".
We're going to create a basic server that will server up a random user and then create a front end client that will consume this service to illustrate how to do authentication with JWTs.
Faker's how we're going to make the random user. We're going to require Express and we'll require Faker. Then we'll create our app. Then we'll have our app and have a get on random user with the request and response.
We'll save our "User = faker.Helpers.userCard" and "user.avatar = faker.Image.avatar." Then we'll say response send back the user as JSON. Then I will have our app listen on port 3000. We'll just say, "App listening on localhost:3000."
We're going to use nodemon to have our server automatically restart every time we make changes so nodemon server js.
Here we'll go to local host:3000. Obviously we can't get a route but we can get random user. Here every time we refresh we have a random user.