Skip to content

Commit

Permalink
Merge pull request #112 from TwilioDevEd/github-actions
Browse files Browse the repository at this point in the history
Add github actions workflow
  • Loading branch information
jefflinwood authored Oct 28, 2021
2 parents 4c65c76 + 26dd0f8 commit d14d10a
Show file tree
Hide file tree
Showing 5 changed files with 2,018 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ CLIENT_SECRET=

VERIFICATION_SERVICE_SID=

COUNTRY_CODE=
COUNTRY_CODE=

NODE_ENV=production
36 changes: 36 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [master]
paths-ignore:
- "**.md"
pull_request:
branches: [master]
paths-ignore:
- "**.md"

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest]
node-version: [14]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install Dependencies
run: npm ci
- run: npm run build --if-present
- run: npm test
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SMS Verification for Android - Server for Node.js

[![Node.js CI](https://github.com/TwilioDevEd/sms-verification-android-node/actions/workflows/nodejs.yml/badge.svg)](https://github.com/TwilioDevEd/sms-verification-android-node/actions/workflows/nodejs.yml)

This sample project demonstrates how to use Twilio's [Verify](https://www.twilio.com/verify/)
to verify Android application user's phone numbers. This application supports the [SMS Retriever API](https://developers.google.com/identity/sms-retriever/overview)
from Google.
Expand Down
10 changes: 10 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ app.get('/config', function(request, response) {
});
});

// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
console.trace(err);
res.status(err.status || 500);
res.send({
message: err.message,
error: {},
});
});

// Create http server and run it
const server = http.createServer(app);
Expand Down
Loading

0 comments on commit d14d10a

Please sign in to comment.