This repository has been archived by the owner on Jan 11, 2024. It is now read-only.
forked from noslouch/clicktocongress-node
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Matt Oberle
committed
Mar 17, 2017
1 parent
eadf6bf
commit 4a711da
Showing
8 changed files
with
74 additions
and
17 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,11 @@ | ||
*.log | ||
*.swp | ||
.DS_Store | ||
.env | ||
.jobs | ||
/bundle.js | ||
Dockerfile | ||
README.md | ||
circle.yml | ||
docker-compose.yml | ||
node_modules/ |
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,3 +1,4 @@ | ||
node_modules | ||
.*~ | ||
.env | ||
*.swp |
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,8 @@ | ||
FROM node:7.7-alpine | ||
RUN npm install -g mocha | ||
COPY . /code | ||
RUN chown -R node: /code | ||
WORKDIR /code | ||
USER node | ||
RUN npm install && touch .env | ||
CMD ["node", "index.js"] |
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
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,7 +1,26 @@ | ||
machine: | ||
node: | ||
- 4.3.2 # lambda version | ||
services: | ||
- docker | ||
python: | ||
version: 3.6.0 | ||
|
||
dependencies: | ||
pre: | ||
- npm install mocha -g | ||
cache_directories: | ||
- "~/docker" | ||
override: | ||
- pip3 install -U git+https://github.com/nypublicradio/deploy.git | ||
- ecs_deploy build | ||
|
||
test: | ||
override: | ||
- ecs_deploy test --test-cmd='npm test' | ||
|
||
deployment: | ||
prod: | ||
tag: /v[0-9]+\.[0-9]+\.[0-9]+/ | ||
commands: | ||
- ecs_deploy deploy --env=prod --memory-reservation=64 --port=3000 | ||
demo: | ||
branch: master | ||
commands: | ||
- ecs_deploy deploy --env=demo --memory-reservation=64 --port=3000 |
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,15 @@ | ||
version: '3' | ||
services: | ||
click-to-congress: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
env_file: | ||
- .env | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
- ./index.js:/code/index.js | ||
- ./lib:/code/lib | ||
- ./routes:/code/routes | ||
- ./tests:/code/tests |
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,20 +1,24 @@ | ||
require('dotenv').config(); | ||
|
||
var lambdaExpress = require('lambda-express'); | ||
var express = require('express'); | ||
var morgan = require('morgan'); | ||
var apiRouter = express.Router(); | ||
var app = express(); | ||
var cors = require('cors'); | ||
|
||
app.use(cors()); | ||
app.options('*', cors()); | ||
const apiPrefix = process.env.API_PREFIX || '/'; | ||
|
||
app.use('/api/lookup', require('./routes/lookup')); | ||
app.use('/api/call', require('./routes/call')); | ||
app.use('/api/connect', require('./routes/connect')); | ||
morgan.token('remote-addr', function (req, res) { | ||
var realIP = req.headers['x-real-ip']; | ||
return realIP || req.connection.remoteAddress; | ||
}); | ||
|
||
apiRouter.use('/v1/lookup', require('./routes/lookup')); | ||
apiRouter.use('/v1/call', require('./routes/call')); | ||
apiRouter.use('/v1/connect', require('./routes/connect')); | ||
app.use(morgan('combined')); | ||
app.use(apiPrefix, apiRouter); | ||
|
||
var server = app.listen(3000, function() { | ||
var port = server.address().port; | ||
console.log('Listening at port %s', port); | ||
}); | ||
|
||
exports.handler = lambdaExpress.appHandler(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