Skip to content

Commit

Permalink
chore: setup basic client and server implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra authored Sep 8, 2024
1 parent 538881a commit 92bcca7
Show file tree
Hide file tree
Showing 30 changed files with 6,147 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
HOSTNAME=http://localhost
CLIENT_PORT=5173
SERVER_PORT=3000
21 changes: 21 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2
updates:
- package-ecosystem: "npm"
target-branch: main
directory: "."
schedule:
interval: "daily"
versioning-strategy: increase
groups:
npm:
patterns:
- "*"
- package-ecosystem: "github-actions"
target-branch: main
directory: ".github/workflows"
schedule:
interval: "daily"
groups:
gha:
patterns:
- "*"
25 changes: 25 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"packages": {
".": {
"include-component-in-tag": false,
"release-type": "node",
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section": "Chores",
"hidden": false
}
]
}
}
}
3 changes: 3 additions & 0 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
20 changes: 20 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: cd

on:
push:
branches:
- main

jobs:
release-please:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- name: Release Please
uses: googleapis/release-please-action@v4.1.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ci

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Setup Volta
uses: volta-cli/action@v4.2.1
- name: Install dependencies
run: npm ci
- name: Test project
run: npm run test
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# runtime
.env
node_modules

# application
coverage
out
./api/main.cjs
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# chat
# Chat

A hosted chat app solution

Roadmap

## License

MIT
11 changes: 11 additions & 0 deletions api/main.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import request from 'supertest'
import { describe, it, expect } from 'vitest'

import app from './main'

describe('Routes', () => {
it('should respond with 200 on GET /', async () => {
const res = await request(app).get('/')
expect(res.status).toBe(200)
})
})
21 changes: 21 additions & 0 deletions api/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import process from 'node:process';

import { config } from 'dotenv';
import express from 'express';

config();

const app = express();

const hostname = process.env.HOSTNAME;
const port = process.env.SERVER_PORT;

app.get('/', (_, res) => {
res.send('Hello World');
});

app.listen(3000, () => {
console.log(`Server is running on ${hostname}:${port}`);
});

export default app;
Loading

0 comments on commit 92bcca7

Please sign in to comment.