Skip to content
Open

add . #1511

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
Binary file added .DS_Store
Binary file not shown.
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"root": true,
"env": {
"node": true,
"browser": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"extends": ["plugin:react/recommended", "plugin:react/jsx-runtime"],
"rules": {
"react/react-in-jsx-scope": "off",
"semi": [2, "always"]
},
"settings": {
"react": {
"version": "detect"
}
}
}
Binary file added .github/.DS_Store
Binary file not shown.
11 changes: 11 additions & 0 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Issue event
on: issues

jobs:
PrintIssue:
runs-on: ubuntu-22.04
steps:
- name: Echo
run: echo ${{ github.event.issue.number }}


22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build Node
on: [push,workflow_dispatch]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v6.4.0
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Run lint
run: npm run lint
- name: Run Build
run: npm run build
- name: Run test
run: npm run test

24 changes: 24 additions & 0 deletions .github/workflows/demo1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Events Demo 1
on:
workflow_dispatch:
push:
branches:
- feature
paths-ignore:
- 'src/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Output event data
run: echo "${{ toJSON(github.event) }}"
- name: Get code
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Test code
run: npm run test
- name: Build code
run: npm run build
- name: Deploy project
run: echo "Deploying...."
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deployment
on:
push:
branches:
- main
- dev
jobs:
test:
environment: testing
runs-on: ubuntu-latest
steps:
- name: Get Code
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-deps-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Run server
run: npm start & npx wait-on http://127.0.0.1:XYZ
- name: Run tests
run: npm test
- name: Output information
run: echo "..."
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- name: Output information
run: |
echo "..."
77 changes: 77 additions & 0 deletions .github/workflows/execution-flow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Website Deployment
on:
push:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
test:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Test code
id: test_step
run: npm run test
- name: Upload test report
if: failure() && steps.test_step.outcome == 'failure'
uses: actions/upload-artifact@v6
with:
name: test-report
path: test.json
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: ~/.npm
key: deps-node-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Build website
id: build-website
run: npm run build
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: dist-files
path: dist
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Get build artifacts
uses: actions/download-artifact@v3
with:
name: dist-files
- name: Output contents
run: ls
- name: Deploy
run: echo "Deploying..."
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

12 changes: 12 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import bodyParser from 'body-parser';
import express from 'express';

import eventRoutes from './routes/events.js';

const app = express();

app.use(bodyParser.json());

app.use(eventRoutes);

app.listen(process.env.PORT);
25 changes: 25 additions & 0 deletions data/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MongoClient } from 'mongodb';

const clusterAddress = process.env.MONGODB_CLUSTER_ADDRESS;
const dbUser = process.env.MONGODB_USERNAME;
const dbPassword = process.env.MONGODB_PASSWORD;
const dbName = process.env.MONGODB_DB_NAME;

const uri = `mongodb+srv://${dbUser}:${dbPassword}@${clusterAddress}/?retryWrites=true&w=majority`;
const client = new MongoClient(uri);

console.log('Trying to connect to db');

try {
await client.connect();
await client.db(dbName).command({ ping: 1 });
console.log('Connected successfully to server');
} catch (error) {
console.log('Connection failed.');
await client.close();
console.log('Connection closed.');
}

const database = client.db(dbName);

export default database;
48 changes: 0 additions & 48 deletions github-api-integration-module.sh

This file was deleted.

13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading