@mcansh/next-now-base-url
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

@mcansh/next-now-base-url

get the base url for your now.sh deployment in next.js

import { getBaseURL } from '@mcansh/next-now-base-url';
import fetch from 'isomorphic-unfetch';

const Index: NextPage = () => <h1>Hello</h1>;

Index.getInitialProps = async ({ req }) => {
  const base = getBaseURL(req);
  const data = await fetch(`${base}/api/something`);
  return { data };
};

export default Index;

Readme

Keywords

none

Package Sidebar

Install

npm i @mcansh/next-now-base-url

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

6.86 kB

Total Files

10

Last publish

Collaborators

  • mcansh