Graceful stopping and minor fixes
This commit is contained in:
parent
7a7e3bb2b3
commit
95c93012be
|
@ -28,7 +28,8 @@ services:
|
|||
fe-middleware:
|
||||
image: oven/bun:1
|
||||
container_name: fe-middleware
|
||||
command: bun run docker-dev
|
||||
entrypoint: /bin/bash -c
|
||||
command: ["bun --hot run src/index.ts"]
|
||||
working_dir: /usr/src/app
|
||||
ports:
|
||||
- "8081:8081"
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "bun run src/index.ts",
|
||||
"docker-dev": "bun --hot run src/index.ts",
|
||||
"dev": "docker compose down -v && docker compose up",
|
||||
"test": "docker compose down -v && docker compose run fe-middleware bun test"
|
||||
"test": "docker compose down -v && docker compose run fe-middleware 'sleep 5 && bun test'"
|
||||
}
|
||||
}
|
|
@ -3,6 +3,13 @@ import app from "./app";
|
|||
|
||||
const PORT = env.PORT;
|
||||
|
||||
app.listen(PORT, () =>
|
||||
const server = app.listen(PORT, () =>
|
||||
console.log(`Express server listening on port ${PORT}`)
|
||||
);
|
||||
|
||||
process.on("SIGTERM", (code) => {
|
||||
server.close(() => {
|
||||
console.log('Server closed.');
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
|
@ -6,7 +6,6 @@ class BotApiService {
|
|||
|
||||
async getAll(): Promise<BotApiResponse> {
|
||||
const get_url = `${this.BOT_API_URI}/images`;
|
||||
console.log(`Connecting to "${get_url}"...`)
|
||||
const response: BotApiResponse = await fetch(get_url)
|
||||
.then(res => {
|
||||
if (!res.ok) {
|
||||
|
|
|
@ -27,7 +27,6 @@ describe("endpoint returns the correct status codes", () => {
|
|||
|
||||
it("should return 500 if any error happens", async () => {
|
||||
mock.module("../../src/services/ImageService", () => {
|
||||
let alreadyCalled = false;
|
||||
return {
|
||||
default: {
|
||||
get: () => {
|
||||
|
|
Loading…
Reference in New Issue