add docker
This commit is contained in:
parent
dcb2b5ee53
commit
e9d703ec7c
10 changed files with 316 additions and 25 deletions
|
|
@ -10,6 +10,10 @@ import {
|
|||
|
||||
const app = express();
|
||||
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ status: 'ok' });
|
||||
});
|
||||
|
||||
const hourlyLimiter = rateLimit({
|
||||
windowMs: 60 * 60 * 1000,
|
||||
max: 1000,
|
||||
|
|
@ -35,7 +39,6 @@ app.get('/quotes/:id', onGetQuoteById);
|
|||
app.get('/translations', onGetTranslations);
|
||||
app.get('/images', onGetImages);
|
||||
|
||||
const port = process.env.PORT ? Number(process.env.PORT) : 8080;
|
||||
app.listen(port, () => {
|
||||
console.log(`Server is running on http://localhost:${port}`);
|
||||
app.listen(8080, () => {
|
||||
console.log(`Server is running on http://localhost:8080`);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Request, Response } from 'express';
|
||||
import { getQuote, getRandomQuote, listTranslations } from './data/db.js';
|
||||
import { getQuote, getRandomQuote, listTranslations } from './data/quote.js';
|
||||
import { listRandomImages } from './data/unsplash.js';
|
||||
|
||||
function onGetRandomQuote(_req: Request, res: Response): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue