-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from primer-io/u/at/clean
Clean
- Loading branch information
Showing
17 changed files
with
2,006 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
API_KEY= | ||
# API key of your environment | ||
PRIMER_API_KEY= | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
dist | ||
node_modules | ||
|
||
.env | ||
.env | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,64 @@ | ||
# Server Deno Hono | ||
![Primer Banner](https://github.com/primer-io/example-backend/raw/main/images/primer-banner.png) | ||
|
||
In this example we build a server to integrate with Primer's API. | ||
# 💳 Primer Example Backend | ||
|
||
It uses [Deno](https://deno.land) as the runtime and [Hono](https://hono.dev) as the HTTP server framework, but feel free to build your server however you'd like. | ||
This project is a very simple companion backend to the example apps of [Primer](https://primer.io) Universal Checkout: | ||
|
||
## Running on your browser | ||
- [Example iOS apps](https://github.com/primer-io/checkout-examples-ios) | ||
- [Example Android apps](https://github.com/primer-io/checkout-examples-android) | ||
|
||
[Click here to immediately launch it on your browser](https://stackblitz.com/github/primer-io/checkout-web/tree/main/examples/server-deno-hono). | ||
--- | ||
|
||
Once it's open, make sure to: | ||
_This server uses [Node](https://nodejs.org/) as the runtime (v16 to be compatible with Glitch) and [Fastify](https://fastify.dev/) as the HTTP server framework._ | ||
|
||
1. Create a new file `.env` and copy contents from `.env.example` into it | ||
2. Get an `API_KEY` from your Primer Dashboard and paste it there | ||
- Example: `API_KEY=1234-foo-bar-4321` | ||
# 🚀 Get started | ||
|
||
## Running locally | ||
## Pre-requisites | ||
|
||
- A Primer sandbox account 👤 | ||
|
||
- An API key for your Sandbox 🔑 <br /> You can grab your API key or create a new one from the [Primer Dashboard](https://sandbox-dashboard.primer.io/developers/apiKeys). | ||
|
||
## Deploy on Glitch ⚡️ | ||
|
||
_We recommend using Glitch to quickly spin up a new instance of your server for free._ | ||
|
||
1. First, click on this button to open the project in Glitch and start the server. <br /> _It may take a moment to start._ | ||
|
||
[![Remix With Glitch](https://cdn.glitch.com/2703baf2-b643-4da7-ab91-7ee2a2d00b5b%2Fremix-button-v2.svg?v=1622676640618)](https://glitch.com/edit/#!/import/github/primer-io/example-backend) | ||
|
||
2. On Glitch, open the file `.env`. <br /> Set the environment variable `PRIMER_API_KEY` to your Primer sandbox API key. | ||
|
||
3. On Glitch, grab the URL of your Glitch instance. <br /> It should look like `https://xxx-yyy-zzz.glitch.me`. | ||
|
||
4. Paste your Glitch instance URL in the example project. | ||
|
||
## Run it locally | ||
|
||
1. First, make sure [Node](https://nodejs.org) is installed on your machine. | ||
2. Clone this repository: | ||
|
||
1. Install [Deno](https://deno.land) | ||
2. Follow the same instructions described on the section above about the `API_KEY` | ||
3. Execute the following script on a terminal window: | ||
```sh | ||
deno task start | ||
git clone https://github.com/primer-io/example-backend.git | ||
|
||
cd ./example-backend | ||
``` | ||
|
||
3. Install the dependencies: | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
4. Clone the file `.env.example` and call it `.env`. Set the environment variable `PRIMER_API_KEY` to your Primer sandbox API key. | ||
|
||
5. Execute the following script on a terminal window: | ||
```sh | ||
npm start | ||
``` | ||
|
||
# 🤖 Capabilities | ||
|
||
- `GET /` <br /> Health check | ||
|
||
- `POST /client-session` <br /> Create a client session |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.