This application is a simple blogging site created with NextJS and TypeORM that allows visitors to read or submit markdown-formatted blog posts.
This guide assumes:
First, run the development server:
npm run dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying src/pages/index.js. The page auto-updates as you edit the file.
The src/pages/api directory is mapped to /api/*. Files in this directory are treated as API routes instead of React pages.
run the terminal commands:
# Compile the app
npx tsc && klotho . --app ts-nextjs-typeorm -p aws
# Go into the compiled directory
cd compiled
# If you didn't set the aws region as indicated in the compiler output, do that now
pulumi config set aws:region <YOUR_REGION> -s ts-nextjs-typeorm
# Set a username and password to be used for accessing `UsersDB`
pulumi config set ts-nextjs-typeorm:usersdb_username <USERNAME> -s ts-nextjs-typeorm
pulumi config set --secret ts-nextjs-typeorm:usersdb_password <PASSWORD> -s ts-nextjs-typeorm
# npm install pulumi dependencies
npm install
# Deploy
pulumi up -s ts-nextjs-typeorm
# Outputs: {
# apiUrl: 'https://<...>.execute-api.<YOUR_REGION>.amazonaws.com/stage/'
# }
For instructions on calling your service, follow the (tutorial)[https://klo.dev/docs/tutorials/use_cases/nextjs_typeorm] for complete steps.
# Tear down when done
pulumi destroy -s ts-nextjs-typeorm