diff --git a/.env.example b/.env.example index f916040..8d193a2 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ TWITTER_CONSUMER_SECRET= TWITTER_ACCESS_TOKEN= TWITTER_ACCESS_TOKEN_SECRET= -REDIS_HOSTNAME= +REDIS_HOSTNAME=localhost REDIS_PORT=6379 REDIS_PASSWORD= @@ -11,11 +11,11 @@ LAMBDA_FUNCTION_NAME=testLambdaFunction LAMBDA_FUNCTION_ARN="arn:aws:lambda:::function:testLambdaFunction" TWITTER_SCREEN_NAME=RemindMe_OfThis -TWITTER_CALLBACK_URL=http://127.0.0.1:4000/_/completetwittersignin +TWITTER_CALLBACK_URL=http://localhost:3000/_/completetwittersignin -EXTERNAL_URL=remindmeofthis.app +EXTERNAL_URL=http://localhost:3000 FIREBASE_PROJECT_ID=remindmeofthistweet SENTRY_DSN= -NODE_ENV= \ No newline at end of file +NODE_ENV=development \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8996c46 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,23 @@ +# Contribution and Development + +## Requirements +- Node.js v12 or later +- A Redis server. You can run one easily with Docker: `docker run --name remindme-redis -d -p 6379:6379redis redis-server --appendonly yes` +- The Serverless framework: `npm i -g serverless` +- If you're going to use the Sign In With Twitter functionality, you'll need to create a Twitter app at [developer.twitter.com](http://developer.twitter.com). Alternately, you can use the local Twitter mock API (not implemented yet). + +## Setting up +1. Clone the repo and install dependencies. +2. Create a `.env` file by copying the `.env.example` file. +3. Set the `TWITTER_CONSUMER_KEY`,`TWITTER_CONSUMER_SECRET`,`TWITTER_ACCESS_TOKEN`, and `TWITTER_ACCESS_TOKEN_SECRET` values in your `.env` file to the values from your Twitter app. +4. Enable 3-legged OAuth on your Twitter app dashboard, and include `http://localhost:3000/_/completetwittersignin` as one of your callback URLs. +5. Ensure your Redis server is running. +6. Start the service by running `npm run local`. This will start all the http functions (accessible from http://localhost:3000) as well as schedule the `checkForRemindersAndSend` function to run every minute. + + +## Tests +- Tests are written in Jest, and cover mainly the time parsing features and some end-to-end tests (with the Twitter API mocked to an extent). To run tests: `npm run tests`. + + +## Linting +Linting is used to help catch errors: `npm run lint`. \ No newline at end of file diff --git a/README.md b/README.md index 688645f..da50e70 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,4 @@ This architecture isn't perfect, and I'm open to criticism and suggestions. It's ## Development -- To run a function locally, use the `npm run invoke` script It calls `serverless invoke local`, so see the [available list of options](https://www.serverless.com/framework/docs/providers/aws/cli-reference/invoke-local/). -- Tests are written in Jest, and cover mainly the time parsing features and some end-to-end tests (with the Twitter API mocked to an extent). To run tests: `npm run tests`. -- Linting is used to help catch errors: `npm run lint`. \ No newline at end of file +See the [contributing and development guide](./CONTRIBUTING.md) for details on working on this project. \ No newline at end of file