Web API for Send notifications to Google Nest
pnpm install
cp .env.example .env
pnpm dev
curl -X POST -H "Accept: application/json" -H 'Content-Type: application/json' -d '{"deviceName":"rachael","text":"Hello world","language":"en"}' http://localhost:3000/notifications
curl -X POST -H "Accept: application/json" -H 'Content-Type: application/json' -d '{"deviceName":"rachael","text":"日本語でおk","language":"ja"}' http://localhost:3000/notifications
pnpm test
pnpm build
pnpm start
pnpm reload
pnpm restart
pnpm stop
npx pm2 list
┌─────┬─────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼─────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ google-nest-notifier │ default │ 0.0.2 │ cluster │ 84050 │ 4s │ 2 │ online │ 0% │ 48.1mb │ pi │ disabled │
└─────┴─────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
pnpm logs
pnpm logs --lines 50
You can use ngrok.
Sign up ngrok and set your token to .env
so that your tunnels don't time out.
pnpm start
pnpm logs
Copy your ngrok url from pm2 logs.
Forwarding: https://xxxxxxxx.ngrok-free.app
-> http://localhost:3000
curl -X POST -H "Accept: application/json" -H 'Content-Type: application/json' -d '{"deviceName":"rachael","text":"Hello world","language":"en"}' https://xxxxxxxx.ngrok-free.app/notifications
- Create AWS API Gateway
- Set your AWS API Gateway info to
.env
pnpm start
pnpm logs
Copy your AWS API Gateway url from pm2 logs.
HttpProxy: https://xxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/prod/notifications
-> https://xxxxxxxx.ngrok-free.app/notifications
-> http://localhost:3000/notifications
curl -X POST -H "Accept: application/json" -H 'Content-Type: application/json' -d '{"deviceName":"rachael","text":"Hello world","language":"en"}' https://xxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/prod/notifications
pnpm deploy:setup
pnpm deploy:only
pnpm deploy:install:pnpm
pnpm deploy:install:google-nest-notifier
cp .env.example .env.production
Edit .env.production
scp .env.production {USER}@{HOST}:/var/www/google-nest-notifier/current/examples/listener/.env
scp .env.production pi@raspberrypi:/var/www/google-nest-notifier/current/examples/listener/.env
pnpm deploy:build
pnpm deploy:start
pnpm deploy
pnpm deploy:logs