Skip to content

Commit

Permalink
support localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
jm1021 committed Dec 7, 2023
1 parent 2d32298 commit 5a5ff0b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
12 changes: 8 additions & 4 deletions _posts/2023-12-15-python-jwt-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ courses: { csp: {week: 17 }}
// prepare HTML result container for new output
const resultContainer = document.getElementById("result");

// prepare URL
var url = "https://flask2.nighthawkcodingsociety.com/api/users/";
// Uncomment next line for localhost testing
// url = "http://localhost:8086/api/users/";
// URL for deployment
var uri = "https://flask2.nighthawkcodingsociety.com"
// Uncomment a line below to match localhost testing
// uri = "http://localhost:8086"
uri = "http://127.0.0.1:8086"

// Users endpoint
const url = uri + '/api/users/';

// set options for cross origin header request
const options = {
Expand Down
13 changes: 7 additions & 6 deletions _posts/2023-12-15-python-jwt-login.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ courses: { csp: {week: 17 }}

<script>
// URL for deployment
var url = "https://flask2.nighthawkcodingsociety.com"
// Comment out next line for local testing
// url = "http://localhost:8086"
// Authenticate endpoint
const login_url = url + '/api/users/authenticate';
var uri = "https://flask2.nighthawkcodingsociety.com"
// Uncomment a line below to match localhost testing
// uri = "http://localhost:8086"
uri = "http://127.0.0.1:8086"

// Authenticate endpoint
const url = uri + '/api/users/authenticate';

function login_user(){
// Set body to include login data
Expand All @@ -49,7 +50,7 @@ courses: { csp: {week: 17 }}
};

// Fetch JWT
fetch(login_url, requestOptions)
fetch(url, requestOptions)
.then(response => {
// trap error response from Web API
if (!response.ok) {
Expand Down

0 comments on commit 5a5ff0b

Please sign in to comment.