Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Nextjs SSR example #49

Merged
merged 6 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"parserOptions": {
"ecmaVersion": 2018
},
"ignorePatterns": ["examples/**/*"],
raynerljm marked this conversation as resolved.
Show resolved Hide resolved
"overrides": [
{
"files": ["*.ts"],
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ dist
.tern-port

dist/

.DS_Store
3 changes: 3 additions & 0 deletions examples/nextjs-ssr/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SGID_CLIENT_ID=
SGID_CLIENT_SECRET=
SGID_PRIVATE_KEY=
3 changes: 3 additions & 0 deletions examples/nextjs-ssr/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 36 additions & 0 deletions examples/nextjs-ssr/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
21 changes: 21 additions & 0 deletions examples/nextjs-ssr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# sgID Next.js (SSR) Example

This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

Before you can run the development server, you will have to register your client on the sgID [developer portal](https://developer.id.gov.sg/).

- For this example, you will need to include the following scopes `[openid, myinfo.name]` and register the following redirect URL `http://localhost:3000/success`

> For more information about sgID, please visit the [developer documentation](https://docs.id.gov.sg/).
Copy the `.env.example` file, rename it to `.env`, and fill in your credentials obtained during registration.
raynerljm marked this conversation as resolved.
Show resolved Hide resolved

Then, run the development server by running:

```bash
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
5 changes: 5 additions & 0 deletions examples/nextjs-ssr/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
4 changes: 4 additions & 0 deletions examples/nextjs-ssr/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = nextConfig;
Loading