Build a “Serverless” Stripe Store in 5 Minutes with Node.js andStdLib

Stripe is redefining e-commerce. Patrick and John Collison had a very specific insight into the future of internet businesses: primarily, they’re driven by the software developers who build them. They have, along with one of the most talented , creative teams in Silicon Valley, created a $9.2B business with powerful financial APIs as the centerpiece.

At StdLib (“Standard Library”) , we share a similar vision of the future of business. Our goal is to lower the barrier to entry to creating web products based on new “serverless” technology. We make it even easier for a broader class of developer to build backend services and integrate with companies likeSlack to build bots, and Twilio to build messaging hubs . Today we’re pleased to show you how in only a few minutes, you can build a production-ready Stripe-powered store that is fully-customizable using StdLib.


Build a
StdLib Stripe

We think you’ll find with StdLib that you’ve never had an easier time managing web services. You only have to think in functions, and we have a suite of powerful command line tools that allow for rapid local development and testing .

Once you’ve created your StdLib service in Minute 5 , you’ll get a README.md file but can also follow along via GitHub in the stdlib/utils.templates stripe folder .

What You’ll Need Beforehand 1x Stripe Account (We recommend a new account ) 1x Command Line Terminal 5x Minutes (or 300x Seconds) Minute 1: Preparing Your StripeAccount

First, make sure you’ve created a new Stripe account . We recommend creating a new account because your StdLib store will spontaneously create new products and update your Stripe product information based on configuration you’ve set. To prevent side effects on an already existing account, it’s safest to use a new account.

Once you have your Stripe account, visit the Stripe Dashboard . You don’t need an activated account yet, you’re okay to just use test data to get up and running. Click API in the bottom left of the menu to take you to the API keys page and then Reveal test key token . Keep this page open, you’ll need these API keys shortly.


Build a
Minute 2: Create a StdLibAccount

You’ll now need a StdLib Account to create your “serverless” Stripe Store. We don’t need anything other than a StdLib account and Stripe account to create a store, as Stripe stores product information for us. Navigate to https://stdlib.com and click Sign Up to create your account.


Build a
Click “Sign Up” toProceed Minute 3: Initialize Your StdLib Workspace

To use StdLib, we recommend using the latest stable version of Node.js, ideally 8.2.x or higher installed from the Official Node.js Website . Once complete, open up your Terminal or Command Line and install the StdLib Command Line Tools with the following:

$ npm install lib.cli -g

Please make sure you are running the latest version.At least 3.1.1 , you can check with lib version . You should now have access to the lib command in your terminal. You can use this to make a stdlib directory for your StdLib services.

$ mkdir stdlib $ cd stdlib $ lib init

Use the StdLib credentials you created in the previous step to log in. That’s it, you’re done!

Minute 4: Create Your StripeStore

The next step is creating your Stripe Store using StdLib. You can use the stripe template to automatically generate your Stripe Store for you.

$ lib create -t stripe

When you proceed, you’ll be asked for a Service Name , we suggest stripe-store , but you can name it whatever you’d like.


Build a

By specifying -t stripe , you’re telling the StdLib template service to use the Stripe boilerplate (other options are slack and twilio , for example). This will automatically populate your service with the code you need to run your store, and is fully hackable.

To visit the service you’ve just created, enter the following into your terminal:

$ cd <username>/stripe-store

To make sure your Stripe Store is working as expected, try running a HTTP gateway for your StdLib function locally:

$ lib http

You’ll see the following:


Build a

To visit your Stripe Store and make sure it works, copy and paste the URL provided, localhost:8170/<username>/stripe-store/ into your web browser:


Build a

Awesome! Your Stripe Store is almost ready to go. You can stop your HTTP server at any time by pressing ctrl+C or ctrl+D in your terminal.

Minute 5: Set Stripe Credentials andDeploy

Remember your Stripe credentials from Minute 1 ? You’ll want to make sure you bring up that window or open the API keys page again. Open up ./env.json in your service directory, and enter your credentials into the "local" and "dev" environments.


Build a
Enter Your Credentials

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: Node.jsGitSlackGitHubADM
分页:12
转载请注明
本文标题:Build a "Serverless" Stripe Store in 5 Minutes with Node.js and StdLib
本站链接:http://www.codesec.net/view/561339.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(16)