2019-08-06 22:26:01 +02:00
|
|
|
import Link from 'next/link'
|
2019-12-05 18:04:00 +01:00
|
|
|
import fs from 'fs'
|
|
|
|
import findUp from 'find-up'
|
2019-08-06 22:26:01 +02:00
|
|
|
|
2020-02-27 18:57:39 +01:00
|
|
|
export async function getStaticProps() {
|
2019-12-05 18:04:00 +01:00
|
|
|
const text = fs
|
|
|
|
.readFileSync(
|
|
|
|
findUp.sync('world.txt', {
|
|
|
|
// prevent webpack from intercepting
|
|
|
|
// eslint-disable-next-line no-eval
|
|
|
|
cwd: eval(`__dirname`),
|
|
|
|
}),
|
|
|
|
'utf8'
|
|
|
|
)
|
|
|
|
.trim()
|
2019-09-24 10:50:04 +02:00
|
|
|
return {
|
|
|
|
props: {
|
2019-12-05 18:04:00 +01:00
|
|
|
world: text,
|
2019-11-11 04:24:53 +01:00
|
|
|
time: new Date().getTime(),
|
2019-09-24 10:50:04 +02:00
|
|
|
},
|
2020-04-02 20:29:41 +02:00
|
|
|
unstable_revalidate: true,
|
2019-09-24 10:50:04 +02:00
|
|
|
}
|
2019-08-06 22:26:01 +02:00
|
|
|
}
|
|
|
|
|
2019-09-24 10:50:04 +02:00
|
|
|
export default ({ world, time }) => (
|
2019-08-06 22:26:01 +02:00
|
|
|
<>
|
|
|
|
<p>hello {world}</p>
|
2019-12-30 23:57:06 +01:00
|
|
|
<span id="anotherTime">time: {time}</span>
|
2019-11-11 04:24:53 +01:00
|
|
|
<Link href="/">
|
|
|
|
<a id="home">to home</a>
|
2019-08-06 22:26:01 +02:00
|
|
|
</Link>
|
|
|
|
<br />
|
2019-11-11 04:24:53 +01:00
|
|
|
<Link href="/something">
|
|
|
|
<a id="something">to something</a>
|
2019-08-06 22:26:01 +02:00
|
|
|
</Link>
|
|
|
|
</>
|
2019-09-24 10:50:04 +02:00
|
|
|
)
|