Skip to content

Commit

Permalink
Merge branch 'main' into feature/favorite-companies
Browse files Browse the repository at this point in the history
  • Loading branch information
ZariaHallager authored Jan 7, 2025
2 parents fee7e58 + 6e89f42 commit 58bd3a4
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 41 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/railway.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Deploy to Railway

on:
pull_request:
branches: [main]
pull_request:
branches: [main]

jobs:
deploy:
runs-on: ubuntu-latest
container: ghcr.io/railwayapp/cli:latest
env:
SVC_ID: f15b9190-b8f5-4122-9418-8e509e648783
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: railway up --service=${{ env.SVC_ID }}
deploy:
runs-on: ubuntu-latest
container: ghcr.io/railwayapp/cli:latest
env:
SVC_ID: f15b9190-b8f5-4122-9418-8e509e648783
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: railway up --service=${{ env.SVC_ID }}
46 changes: 30 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
Kinfolx: An app that allows you rate companies based on their diversity & company culture.
# Kinfolx

Make sure to use npm install to install all Dependencies.
## An app that allows you rate companies based on their diversity & company culture.

you will also need to cd into the server file and do npm install as well because the front and back end have two different package.json files.
View our app live : https://kinfolx-production.up.railway.app/

## Instructions to run the code locally

Make sure to use `npm install` to install all Dependencies.
:exclamation: You will also need to cd into the server file and do npm install as well because the front and back end have two different package.json files.

### Running the servers

1. Start the frontend server:

```
bash
npm i
npm run dev
```

2. Start the backend server:

```
bash
cd server
npm i
npm run dev
```

1. Start the backend server:
```bash
cd server
npm i
npm run dev
```
2. Start the frontend server:
```bash
npm i
npm run dev
```
3. Open your browser and go to `http://localhost:5173`
The backend server is loading from `http://localhost:3000`
The backend server is loading from `http://localhost:3000`

### Environment Variables

One ENV goes inside of the config file inside the server and the other ENV is in the root

```
VITE_CLERK_PUBLISHABLE_KEY=clerk_key_here
DB_STRING=mongodb_string_here
CLERK_SECRET_KEY=clerk_secret_key_here
CLERK_PUBLISHABLE_KEY=clerk_publishable_key_here
```

Front end needs "VITE_" prefixing all keys
Front end needs "VITE\_" prefixing all keys
15 changes: 15 additions & 0 deletions server/controllers/company.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Company from '../models/Company.js'

const companyController = {
getAllCompanies: async (req, res, next) => {
try {
const companies = await Company.find({})
console.log(companies)
res.json({ companies })
} catch (error) {
next(error)
}
},
}

export default companyController
7 changes: 3 additions & 4 deletions server/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const userController = {
if (!clerkId) {
return res.status(400).json({ msg: 'Sign in first' })
}
const user = await clerkClient.users.getUser(clerkId);
const user = await clerkClient.users.getUser(clerkId)

await User.updateOne(
await User.updateOne(
{ clerkId: clerkId },
{
$set: {
Expand All @@ -19,7 +19,7 @@ const userController = {
username: user.username,
},
},
{ upsert: true },
{ upsert: true },
)
} catch (error) {
next(error)
Expand Down Expand Up @@ -47,7 +47,6 @@ const userController = {
next(error)
}
}

}

export default userController
3 changes: 3 additions & 0 deletions server/routes/company.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import express from 'express'
const companyRouter = express.Router()
import companyController from '../controllers/company.js'

companyRouter.get('/', companyController.getAllCompanies)

export default companyRouter
2 changes: 1 addition & 1 deletion server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ app.get(
//route middleware
app.use('/api/company', companyRouter)
app.use('/api/review', reviewRouter)
app.use('/api/user', requireAuth({ signInUrl: '/sign-in' }), userRouter)
app.use('/api/user', requireAuth({ signInUrl: '/sign-in' }), userRouter)

app.listen(PORT, () => {
console.log(`[server]: Server is running at http://localhost:${PORT}`)
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompanyListing/companyListing.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
}
a {
text-decoration: none;
color: inherit
color: inherit;
}
16 changes: 8 additions & 8 deletions src/components/CompanyReviewSummary/companyReviewSummary.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.content-box {
padding: 3rem;
background-color: #333;
border-radius: 4px;
border: 1px solid #444;
color: #e0e0e0;
font-size: 1.8rem;
}
.content-box {
padding: 3rem;
background-color: #333;
border-radius: 4px;
border: 1px solid #444;
color: #e0e0e0;
font-size: 1.8rem;
}

0 comments on commit 58bd3a4

Please sign in to comment.