curl -sSL https://git.io/Jv0mR | sudo bash
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
// source: https://github.com/notablemind/renm/blob/master/src/utils/Lets.re | |
module Async = { | |
type t('a) = Js.Promise.t('a); | |
let try_ = (promise, continuation) => Js.Promise.catch(continuation, promise); | |
let let_ = (promise, continuation) => | |
Js.Promise.then_(continuation, promise); | |
let resolve = Js.Promise.resolve; | |
let reject = Js.Promise.reject; | |
let map = (promise, fn) => Js.Promise.then_(v => Js.Promise.resolve(fn(v)), promise); |
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
/** | |
AsyncData represents the state of data that is being loaded asynchronously. | |
This type does not represent failures by default, but it can by using Belt.Result.t as your 'a type. | |
The reason for this is that not all async data loading mechanisms will necessarily fail. | |
The other interesting bit is that `Reloading` can be used if you already have data (e.g. an Ok or Error Result), | |
but you need to reload the data to get a new Result. | |
*/ |
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
123 |
Next.js Environment Variables
- Usage is simple, you could directly access the config via
process.env.NEXT_PUBLIC_*
, for example:
// call-site, agents.js
const restaurantApi = axios.createConfig({
baseUrl: process.env.NEXT_PUBLIC_RESTAURANT_API_URI,
OlderNewer