diff --git a/.github/workflows/railway.yaml b/.github/workflows/railway.yaml index 1dd1647..126afae 100644 --- a/.github/workflows/railway.yaml +++ b/.github/workflows/railway.yaml @@ -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 }} \ No newline at end of file + 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 }} diff --git a/README.md b/README.md index d3b5292..d3057f2 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,40 @@ -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 @@ -28,4 +42,4 @@ CLERK_SECRET_KEY=clerk_secret_key_here CLERK_PUBLISHABLE_KEY=clerk_publishable_key_here ``` -Front end needs "VITE_" prefixing all keys \ No newline at end of file +Front end needs "VITE\_" prefixing all keys diff --git a/server/controllers/company.js b/server/controllers/company.js index e69de29..0b1facf 100644 --- a/server/controllers/company.js +++ b/server/controllers/company.js @@ -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 diff --git a/server/controllers/user.js b/server/controllers/user.js index a24e871..3aa09fd 100644 --- a/server/controllers/user.js +++ b/server/controllers/user.js @@ -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: { @@ -19,7 +19,7 @@ const userController = { username: user.username, }, }, - { upsert: true }, + { upsert: true }, ) } catch (error) { next(error) @@ -47,7 +47,6 @@ const userController = { next(error) } } - } export default userController diff --git a/server/routes/company.js b/server/routes/company.js index b228091..6b7533f 100644 --- a/server/routes/company.js +++ b/server/routes/company.js @@ -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 diff --git a/server/server.js b/server/server.js index 13b3287..b6b41e4 100644 --- a/server/server.js +++ b/server/server.js @@ -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}`) diff --git a/src/components/CompanyListing/companyListing.css b/src/components/CompanyListing/companyListing.css index c47bc2d..d0e8bbe 100644 --- a/src/components/CompanyListing/companyListing.css +++ b/src/components/CompanyListing/companyListing.css @@ -25,5 +25,5 @@ } a { text-decoration: none; - color: inherit + color: inherit; } diff --git a/src/components/CompanyReviewSummary/companyReviewSummary.css b/src/components/CompanyReviewSummary/companyReviewSummary.css index ccd399d..91f68c0 100644 --- a/src/components/CompanyReviewSummary/companyReviewSummary.css +++ b/src/components/CompanyReviewSummary/companyReviewSummary.css @@ -1,8 +1,8 @@ -.content-box { - padding: 3rem; - background-color: #333; - border-radius: 4px; - border: 1px solid #444; - color: #e0e0e0; - font-size: 1.8rem; -} \ No newline at end of file +.content-box { + padding: 3rem; + background-color: #333; + border-radius: 4px; + border: 1px solid #444; + color: #e0e0e0; + font-size: 1.8rem; +}