Skip to content

Commit

Permalink
feat: add health API (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Bodin committed Jul 10, 2021
1 parent 6b248b5 commit 95587a3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Expand Up @@ -51,9 +51,9 @@ jobs:
working_directory: ~/repo
steps:
- attach_workspace: *attach_work_dir
- run:
name: Release
command: yarn semantic-release
# - run:
# name: Release
# command: yarn semantic-release
- run:
name: Docker Build
command: yarn docker:build
Expand Down
18 changes: 18 additions & 0 deletions src/api.ts
@@ -0,0 +1,18 @@
import http from 'http';

import { log } from './utils/log';

export function createAPI(): void {
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(
JSON.stringify({
code: 200,
})
);
});

server.listen(8000, () => {
log.info(`⛑ API started on port 8000`);
});
}
3 changes: 3 additions & 0 deletions src/index.ts
@@ -1,5 +1,6 @@
import { StateManager } from './StateManager';
import * as algolia from './algolia/index';
import { createAPI } from './api';
import * as bootstrap from './bootstrap';
import { config } from './config';
import * as jsDelivr from './jsDelivr/index';
Expand Down Expand Up @@ -30,6 +31,8 @@ async function main(): Promise<void> {
process.exit(0);
}, KILL_PROCESS_EVERY_MS);

createAPI();

// first we make sure the bootstrap index has the correct settings
log.info('💪 Setting up Algolia');
const {
Expand Down

0 comments on commit 95587a3

Please sign in to comment.