MulperiCMS is a markdown blogging platform that includes following applications.
At first time you need to use npm run make-bucket
to create bucket for the cloudformation template. After that, use npm run package-deploy
to deploy CloudFormation stack with Cognito and it's app client settings and DynamoDB for the blog posts.
Angular blogging app and editor for creating new posts.
To start development, use npm start
.
To deploy Angular client to S3 first time, use npm run make-bucket
to create bucket for the app and then npm run deploy
. The idea is that you have serve the Angular app as a static website from S3.
Node.js REST API for DynamoDB
Server side application with endpoints that the client app use for communicating with the database.
To run API locally, use npm run dev
. You need .env
file with AWS credentials. Use http://localhost:3000/ to access the endpoints.
You need to have mulpericms-posts
table in your DynamoDB with primary key id
.
You need to create a userpool to Cognito and add it's details to API Node.js app.
Also do not enable client secret when creating user pool app client:
"When creating the App, the generate client secret box must be unchecked because the JavaScript SDK doesn't support apps that have a client secret."
Add compiler option -> "types": ["node"]
Add this to polyfills.ts
(window as any).global = window;
heroku ps:exec
From bucket properties, activate Static website hosting
and use index.html
as both Index and Error document.
Also under Permissions, paste following JSON to the Bucket Policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::blog.mulperi.net/*"
}
]
}
npm i -D webpack-bundle-analyzer
- To build and export statistics json run
ng build --prod --stats-json
- Add npm script
"bundle-report": "webpack-bundle-analyzer dist/project/stats.json"
- Open report in browser via
npm run bundle-report
Add to tsconfig.json this line: "esModuleInterop": true