-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nikhil Vijayan
committed
Jul 1, 2021
1 parent
546156b
commit 63146ed
Showing
13 changed files
with
11,154 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
.DS_Store | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM node:14-alpine as base | ||
WORKDIR /usr/src/app | ||
COPY package*.json ./ | ||
RUN npm ci | ||
COPY src src | ||
COPY swagger swagger | ||
COPY index.js index.js | ||
ENV PORT=8080 | ||
|
||
# test step | ||
FROM base as test | ||
COPY test test | ||
|
||
# production step | ||
FROM base as production | ||
WORKDIR /usr/src/app | ||
COPY --from=base usr/src/app . | ||
|
||
EXPOSE 8080 | ||
CMD ["node", "."] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
# Price Drop Alerter | ||
|
||
An API that determines if a price drop alert needs to be triggered for a product. | ||
|
||
## Setup | ||
|
||
### For development | ||
``` | ||
git clone [email protected]:nkhil/price-drop-alerter.git | ||
cd price-drop-alerter | ||
npm install | ||
npm run develop | ||
``` | ||
|
||
## Technology | ||
|
||
- Express | ||
- Swagger | ||
- openapi-express-validator | ||
- Docker / docker-compose | ||
## Tests | ||
|
||
### Run tests in Docker | ||
You can run all automated tests (unit & integration) using the following command | ||
|
||
``` | ||
npm run test:docker | ||
``` | ||
|
||
### Unit tests | ||
|
||
``` | ||
npm run test:unit | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
target: production | ||
ports: | ||
- 8080:8080 | ||
command: node --use_strict index.js | ||
test: | ||
build: | ||
context: . | ||
target: test | ||
depends_on: | ||
- app | ||
command: npm test | ||
volumes: | ||
- ./:/app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const logger = require('pino')(); | ||
const init = require('./src'); | ||
|
||
const { name, port } = require('./src/config'); | ||
|
||
(async () => { | ||
const app = await init(); | ||
app.listen(port, () => { | ||
logger.info({ msg: `${name} is listening on port ${port}` }); | ||
}); | ||
})(); |
Oops, something went wrong.