Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jordanjanakievski/GitHub actions with secrets #27

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
00a2e09
TCES-37 Add Ron Varshavsky to readme
VangoCode Oct 21, 2023
7b7b9b5
Merge branch 'main' into ronvarshavsky1/tces-37-pre-add-yourself-to-t…
VangoCode Oct 24, 2023
2e21561
TCES-12 feat(auth): add skeleton endpoints for auth api
VangoCode Oct 25, 2023
1e80da7
TCES-12 fix(auth): send response on post request
VangoCode Oct 25, 2023
9ef0423
TCES-12 feat(auth) add PassportJS packages
VangoCode Oct 25, 2023
55256fc
TCES-12 config(auth) add LocalStrategy config to auth.js
VangoCode Oct 25, 2023
8433372
TCES-12 feat(auth) add passport middleware and fix SQL bug
VangoCode Oct 25, 2023
aedbbc0
add constants
VangoCode Oct 27, 2023
1aceb36
TCES-12 config(user, frontend) update config variables for frontend a…
VangoCode Oct 27, 2023
45d59f5
TCES-12 config(index) update express to use json body requests
VangoCode Oct 27, 2023
f646231
TCES-12 feat(create-user) implements create_user endpoint
VangoCode Oct 27, 2023
426d4bb
TCES-12 refactor(create_user) fix indentation
VangoCode Oct 27, 2023
42b7e72
TCES-12 feat(login) implements user login
VangoCode Oct 27, 2023
dd3df25
TCES-12 feat(session) implements user session
VangoCode Oct 28, 2023
5b9207b
TCES-12 feat(logout) implements user logout
VangoCode Oct 28, 2023
d05e097
TCES-12 refactor(auth) replace cookie authentication with server-side…
VangoCode Oct 29, 2023
4aa4a9f
TCES-12 feat(auth) add admin feature
VangoCode Oct 30, 2023
52bfcfa
TCES-12 feat(auth) add admin control for creating a user
VangoCode Oct 30, 2023
e7dccfb
Merge branch 'main' into ronvarshavsky1/tces-12-urd-login-logout-and-…
VangoCode Oct 30, 2023
e3f5662
TCES-12 fix(auth) fix error status response
VangoCode Oct 30, 2023
0d920ac
TCES-12 refactor(auth) rewrite functions to use arrow functions
VangoCode Oct 30, 2023
edc09e9
TCES-12 refactor(auth) restructure config file for passport
VangoCode Oct 30, 2023
3dc1201
TCES-12 fix(auth) remove automatic logging in when user created
VangoCode Oct 30, 2023
c7f201e
TCES-12 refactor(auth) remove callback function for hashing
VangoCode Nov 3, 2023
cfac6d5
TCES-12 hotfix(auth) fix hashing function
VangoCode Nov 3, 2023
76b028e
TCES-12 refactor(auth) implement sequelize model for auth
VangoCode Nov 3, 2023
6b35c4d
TCES-12 refactor(auth) implement sequelize for user
VangoCode Nov 3, 2023
3f31021
TCES-12 refactor(auth) implement sequelize in separate file
VangoCode Nov 3, 2023
88fbc71
TCES-12 refactor(auth) refactor localstrategy imports
VangoCode Nov 3, 2023
9f61cae
TCES-12 fix(auth) implements user login feature
VangoCode Nov 3, 2023
79432b2
TCES-12 refactor(auth) update .env.example to remove credentials
VangoCode Nov 4, 2023
fd9ac2c
TCES-12 refactor(auth) update .env.example, index, and update routing
VangoCode Nov 4, 2023
d2888fc
TCES-12 fix(auth) update model to match sql
VangoCode Nov 4, 2023
7714eeb
TCES-12 refactor(auth) refactor all routes to use controller
VangoCode Nov 4, 2023
00e162e
TCES-12 refactor(auth) refactor all controllers to be separate files
VangoCode Nov 4, 2023
1fec3a2
TCES-12 refactor(auth) refactor after formatter and linter
VangoCode Nov 4, 2023
d6d2d94
TCES-12 test(auth) add test cases for createUser
VangoCode Nov 5, 2023
4c29701
TCES-12 refactor(auth_test) refactor test cases for auth to match for…
VangoCode Nov 5, 2023
1dfa393
TCES-12 hotfix(auth_test) fix sequelize connection failure to pass tests
VangoCode Nov 5, 2023
dc9e79d
TCES-12 hotfix(auth_test) fix sequelize connection failure to pass tests
VangoCode Nov 5, 2023
c349499
TCES-12 hotfix(auth_test) fix sequelize connection failure to pass tests
VangoCode Nov 5, 2023
8d88621
Create a .env when running the server tests
jordanjanakievski Nov 5, 2023
013b59e
Linter error changes
jordanjanakievski Nov 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
env:
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}

- name: Set up Node.js
uses: actions/setup-node@v2
Expand Down
8 changes: 7 additions & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# This will connect to the main branch of the db in the final changes
# Rename this to .env and copy a dev branch url to here from PlanetScale
DATABASE_URL=''
DATABASE_NAME='blueprint-tces'
DATABASE_USERNAME=''
DATABASE_PASSWORD=''
DATABASE_HOST='aws.connect.psdb.cloud'
FRONTEND_URL='http://localhost:3000'
USERS_TABLE='users-dev'
SESSION_SECRET=
28 changes: 28 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ const port = 8000;
const mysql = require("mysql2");
const connection = mysql.createConnection(process.env.DATABASE_URL);

// Session storage imports
const passport = require("passport");
var session = require("express-session");
var SQLiteStore = require("connect-sqlite3")(session);

// Import passport configuration
require("./src/configs/passport");

// So that we can send and receive JSON through express
app.use(express.json());

// Import router for all authentication API endpoints
const authRouter = require("./src/routes/auth");

// Set up session for authorization
app.use(
session({
secret: process.env.SESSION_SECRET,
resave: false,
saveUninitialized: false,
store: new SQLiteStore({ db: "sessions.db", dir: "./var/db" }),
}),
);
app.use(passport.authenticate("session"));

app.get("/", (req, res) => {
res.send("Helloooo World!");
});
Expand All @@ -25,3 +50,6 @@ app.get("/users", (req, res) => {
}
});
});

// All endpoints within this API will be found under the /auth subdirectory
app.use("/", authRouter);
Loading
Loading