Skip to content

Spring Boot Rest API that allows users to search for stocks and follow/unfollow stocks

Notifications You must be signed in to change notification settings

keithcaff/StocksApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StocksApi

About

StocksAPI allows users to

  • login to their portfolio
  • search for stocks
  • follow stocks they are interested in
  • unfollow stocks they are no longer interested in

Tech Stack:

  • Spring Boot for creating the RESTful Web Services
  • Okta as the user management store and OAuth2 authorization server
  • MongoDB as StocksApi database
  • Gradle for managing the project's build

Endpoints

Request Method URI Body (JSON) Description
GET http://localhost:8080/stocks/search?keywords=apple - Search for stocks using keywords. Returns the best-matching symbols and market information based on keywords of your choice.
POST http://localhost:8080/user/stocks [ { "symbol": "NKE","name": "NIKE Inc.","region": "United States","currency": "USD"}] Creates a new set of 'followed' stocks for the authorized user
GET http://localhost:8080/user/stocks Gets a set of 'followed' stocks for the authorized user
PUT http://localhost:8080/user/stocks/{userStockId} Updates the set of 'followed' stocks using the userStocksId

Okta

To access the protected server, you need a valid JSON Web Token. Details on how to set up your own Okta Authorization server and get a JWT token can be found here

To run the unit and integration tests

From root of the project gradle:

./gradlew clean build

To run the application

Dependencies

MongoDB - The mongo daemon process needs to be running on localhost:27017. Steps on how to install with homebrew are outlined here

Config

Ensure you have set Okta oauth config values in application.yml file. Populate 'issuer', 'client-id' and 'client-secret' properties

okta:
  oauth2:
    issuer: https://dev-8153053.okta.com/oauth2/default
    client-id: 1234567688
    client-secret: 1234567688
  1. Run the following gradle command from the root project directory:
./gradlew bootRun
  1. You can navigate to localhost:8080/ to view the home screen where you can login/create a user
  2. If you just want to invoke the rest endpoints you can get a valid token using OIDCDebugger. Details on how to get token from OIDC Debugger are outlined in this Okta blog entry here

About

Spring Boot Rest API that allows users to search for stocks and follow/unfollow stocks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published