mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-14 03:04:40 +00:00
update sapper, tidy up
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,4 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
.sapper
|
||||
templates/.*
|
||||
yarn.lock
|
||||
@@ -15,7 +15,7 @@
|
||||
"glob": "^7.1.2",
|
||||
"marked": "^0.3.7",
|
||||
"node-fetch": "^1.7.3",
|
||||
"sapper": "^0.0.22",
|
||||
"sapper": "^0.1.0",
|
||||
"serve-static": "^1.13.1",
|
||||
"style-loader": "^0.19.0",
|
||||
"svelte": "^1.49.1",
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
const { slug } = params;
|
||||
|
||||
return fetch(`/api/blog/${slug}`).then(r => r.json()).then(post => {
|
||||
console.log({ post });
|
||||
return { post };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ const static = require('serve-static');
|
||||
|
||||
const { PORT = 3000 } = process.env;
|
||||
|
||||
// this allows us to do e.g. `fetch('/api/blog')` on the server
|
||||
const fetch = require('node-fetch');
|
||||
global.fetch = (url, opts) => {
|
||||
if (url[0] === '/') url = `http://localhost:${PORT}${url}`;
|
||||
@@ -16,9 +17,7 @@ app.use(compression({ threshold: 0 }));
|
||||
|
||||
app.use(static('assets'));
|
||||
|
||||
app.use(sapper({
|
||||
selector: '#sapper'
|
||||
}));
|
||||
app.use(sapper());
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`listening on port ${PORT}`);
|
||||
|
||||
Reference in New Issue
Block a user