thanhtrungit25 / guitar-inventory

Use TypeScript to Build a Node API with Express

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use TypeScript to Build a Node API with Express

You will need to create an application in Okta:

  • Log in to your Okta account, then navigate to Applications and click the Add Application button
  • Select Web and click Next
  • Give your application a name (e.g. "Simple Node Authentication")
  • Change the Base URI to http://localhost:3000 and the Login redirect URI to http://localhost:3000/authorization-code/callback, then click Done
  • Save your client ID and client secret for later

Your Okta application should have settings similar to the following: Okta Application Settings

Now create a file called .env in the project root and add the following variables, replacing the values with your own from the previous steps.

# Set to production when deploying to production
NODE_ENV=development

# Node.js server configuration
SERVER_PORT=8080
HOST_URL=http://localhost:8080
SESSION_SECRET=[YOUR SECRET SESSION]

# Okta configuration
OKTA_ORG_URL=https://dev-228303.okta.com
OKTA_CLIENT_ID=[YOUR CLIENT ID]
OKTA_CLIENT_SECRET=[YOUR CLIENT SECRET]

# Postgres configuration
PGHOST=localhost
PGUSER=postgres
PGDATABASE=postgres
PGPASSWORD=p@ssw0rd42
PGPORT=5432

Now run the application:

npm install
npm run dev

Guitar List Authed

About

Use TypeScript to Build a Node API with Express


Languages

Language:TypeScript 67.9%Language:HTML 29.9%Language:PLpgSQL 2.2%