This project is a very simple companion backend to the example apps of Primer Universal Checkout:
This server uses Node as the runtime and Fastify as the HTTP server framework.
This project uses Node v16 to be compatible with Glitch but we encourage you to use a more recent version of Node.
-
A Primer sandbox account 👤
-
An API key for your Sandbox 🔑
You can grab your API key or create a new one from the Primer Dashboard.
We recommend using Glitch to quickly spin up a new instance of your server for free.
-
First, click on this button to open the project in Glitch and start the server.
It may take a moment to start. -
On Glitch, open the file
.env
.
Set the environment variablePRIMER_API_KEY
to your Primer sandbox API key. -
On Glitch, grab the URL of your Glitch instance.
It should look likehttps://xxx-yyy-zzz.glitch.me
. -
Paste your Glitch instance URL in the example project.
-
First, make sure Node is installed on your machine.
-
Clone this repository:
git clone https://github.com/primer-io/example-backend.git cd ./example-backend
-
Install the dependencies:
npm install
-
Clone the file
.env.example
and call it.env
. Set the environment variablePRIMER_API_KEY
to your Primer sandbox API key. -
Execute the following script on a terminal window:
npm start
-
GET /
Health check -
POST /client-session
Create a client session