Prerequisites
- Created your Unkey account
- Created an API in the Unkey dashboard
Skip the tutorial
Don’t want to read the tutorial? Click this to get an example ready to test.
Creating an express server
1
Create express application
First run the following:Then update your package.json to have the following
2
Install
Now install the
@unkey/api
package3
Creating the server
Create a file called
server.ts
and add the following codeserver.ts
4
Running the server
5
Try it out
Go to https://app.unkey.com and create a new key. Then verify it with our new server:It should return
{"keyId":"key_id","valid":true,"meta":{},"enabled":true,"permissions":[],"code":"VALID"}
and potentially more information about the key, depending on what you set up in the dashboard.