Skip to content

Commit

Permalink
feat: add Nextjs SSR example (#49)
Browse files Browse the repository at this point in the history
* feat: add nextjs ssr example

* feat: upgrade to PKCE

* fix: cleanup DS_Store

* feat: upgrade store to global store

* feat: update store type declaration
  • Loading branch information
raynerljm authored May 23, 2023
1 parent 25b8bab commit ac94159
Show file tree
Hide file tree
Showing 31 changed files with 7,909 additions and 0 deletions.
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.

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

0 comments on commit ac94159

Please sign in to comment.