This project was bootstrapped with Create Serverless Stack.
Start by installing the dependencies.
$ npm install
Starts the local Lambda development environment.
Build your app and synthesize your stacks.
Generates a .build/
directory with the compiled files and a .build/cdk.out/
directory with the synthesized CloudFormation stacks.
Deploy all your stacks to AWS. Or optionally deploy a specific stack.
Remove all your stacks and all of their resources from AWS. Or optionally remove a specific stack.
Runs your tests using Jest. Takes all the Jest CLI options.
Learn more about the Serverless Stack.
Follow us on Twitter or post on our forums.
200 LOGIN RESPONSE
{
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidXNlcm5hbWUiOiJiYXJha2NvZGVzIiwiaWF0IjoxNjM5MDY1MDM4LCJleHAiOjE2MzkwNjg2MzgsImF1ZCI6Im15c2VyY2llLmNvbSIsImlzcyI6Imh0dHBzOi8vbXlkb21haW4uY29tIn0.D01BmuMRLRFxVoL2Tedd4zEXyQVYbITyb6xIPOSHBhs",
"user": {
"id": 2,
"username": "barakcodes",
"email": "[email protected]"
}
}
}
The token should be placed inside the header for all of your requests as:
{
"Authorization": "Bearer TOKEN_VALUE"
}
If the token is not valid or you do not include the header, you will receive a 401 Unauthorized response. If the token is malformed or expired you will receive a 403 Forbidden response.
- Add your environment variables to your
.env
file.
DATABASE_URL: <PRISMA_DATA_PROXY_URL>,
JWT_AUDIENCE: <YOUR_CLIENT_APP_URL>,
JWT_ISSUER: <YOUR_SERVER_URL>,
JWT_EXPIRES_IN: <TIME IN d,s,m>, eg. 3d, 24h, 60m
JWT_SECRET: <SECRET-STRING>
This is how you would deploy your project to AWS.
- CD to the root of your project. For example, if you are in the
/my-project
directory, runcd my-project
. - Install the dependencies using yarn or npm
$ npm install
OR
$ yarn install
- Run the deployment command.
$ yarn deploy --stage <YOUR-STAGE> --region <YOUR-REGION>
For Hong Kong region is ap-east-1
NOTE: If you have multiple AWS accounts, you can change the deploy script in the package.json
to use your profile like so.
AWS_PROFILE=my-profile npx sst deploy
And then you can use the AWS_PROFILE
environment variable to specify which profile to use.
After this the deployment should be all green ✅ "# columbiaAPI"