Explain the different between a query string parameter and a path parameter. When would you use each?
What would our API URL with a path id parameter be given the following information:
http://our-site.com
stuff
things
http://our-site.com/api/v3/stuff/things
We have created a dynamic API with an “interface”. Describe how that interface works to a non-technical friend.
Describe how you would use middleware to implement basic and bearer Auth.
Basic Auth is implemented by using the express-basic-auth
middleware. The middleware is added to the server, and the middleware is configured with a username and password. When a request is made to a protected route, the middleware will check the request for a username and password. If the username and password are valid, the request will be allowed to continue. If the username and password are invalid, the request will be rejected.
Bearer Auth is implemented by using the express-bearer-auth
middleware. The middleware is added to the server, and the middleware is configured with a secret. When a request is made to a protected route, the middleware will check the request for a bearer token. If the bearer token is valid, the request will be allowed to continue. If the bearer token is invalid, the request will be rejected.
Describe the handshake necessary to implement OAuth.
express-oauth-server
middleware. The middleware is added to the server, and the middleware is configured with a model. When a request is made to a protected route, the middleware will check the request for an access token. If the access token is valid, the request will be allowed to continue. If the access token is invalid, the request will be rejected.Describe how role based access control works to a non-technical friend.
access-control
middleware. The middleware is added to the server, and the middleware is configured with a set of roles. When a request is made to a protected route, the middleware will check the request for a role. If the role is valid, the request will be allowed to continue. If the role is invalid, the request will be rejected.