Skip to content

Commit

Permalink
Serve the API with Express (#150)
Browse files Browse the repository at this point in the history
* Serve the API with Express

* Replace config by convict

* Add Dockerfile and now.json
  • Loading branch information
Kmaschta authored May 15, 2019
1 parent 38d5b98 commit 0cf399c
Show file tree
Hide file tree
Showing 21 changed files with 877 additions and 592 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ before_install:
- psql -c 'create database comfy;' -U postgres
- psql -U postgres comfy < api/var/schema.sql

install: make install migrate
install: make install
script: make test

cache:
Expand Down
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ install:
make -C cli install
make -C test install

migrate:
make -C api migrate

run:
-make -C api start-db
make migrate
make -C api run

test:
Expand Down
1 change: 1 addition & 0 deletions api/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
.serverless
config/*.js
!config/database.js
build/
10 changes: 10 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:10

WORKDIR /usr/src/app

COPY package*.json ./
RUN npm ci --only=production

COPY build ./build

CMD [ "npm", "start" ]
26 changes: 0 additions & 26 deletions api/config/database.js

This file was deleted.

18 changes: 0 additions & 18 deletions api/config/default.js

This file was deleted.

15 changes: 0 additions & 15 deletions api/config/development.js.dist

This file was deleted.

15 changes: 0 additions & 15 deletions api/config/production.js.dist

This file was deleted.

4 changes: 0 additions & 4 deletions api/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ install-db:
docker run --name comfy-db -p 5432:5432 -d postgres:9.6
sleep 5s
psql -c "CREATE DATABASE ${DATABASE}"
make migrate

migrate:
./node_modules/db-migrate/bin/db-migrate up --config ./config/database.js

start-db:
docker start comfy-db
Expand Down
11 changes: 11 additions & 0 deletions api/now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "comfygure-api",
"version": 2,
"builds": [
{
"src": "build/index.js",
"use": "@now/node"
}
],
"routes": [{ "src": ".*", "dest": "/build" }]
}
Loading

0 comments on commit 0cf399c

Please sign in to comment.