Skip to content

Commit

Permalink
15 frontend strapi setup (#47)
Browse files Browse the repository at this point in the history
* docs(backend): 📝 update readme with .env random string generation instructions

* feat(frontend): ✨ fetch example blog data from strapi

* fix(ide): fix root package lock

* feat: 🏷️ Setup Strapi type generation

* chore(frontend): rename strapi types folder

* docs: 📝 Describe type generation in docs

* docs: update docs

* docs: update docs

* feat: ✨ Fetch and dispay blog posts from backend

* fix(frontend): 💚 remove unused vars

* build: 💚 wip fix cloudflare build deployment

* style(frontend): run prettier

* build(frontend): 💚 Try to fix cloudflare ssr pages

* feat(backend): setup Strapi for Heroku deployment

* build(backend): update required npm version to fix heroku build

* build(backend): update node version in package.lock to fix heroku deploy

* build: Setup environment variable for prod heroku and dev localhost

* docs(backend): 📝 Add heroku documentation

* refactor: remove console log

* refactor: remove unnecessary export because edge runtime disables static generation

* feat(frontend): ✨ Add Author image fetching

* refactor(frontend): ♻️ Rename fetch functions to better imply what they do
  • Loading branch information
Magnus Strømseng authored and GitHub committed Jan 26, 2024
1 parent e6e98f9 commit bf4de0c
Show file tree
Hide file tree
Showing 34 changed files with 8,983 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Empty file removed .package.json
Empty file.
2 changes: 2 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Copy the `.env.example` file and paste it as a `.env`. Now edit all the example `toBeModified` values to random strings.

The random strings should be generated using `openssl rand -base64 32` on macos and linux to ensure security as specified [here](https://docs.strapi.io/dev-docs/migration/v4/migration-guide-4.0.6-to-4.1.8#setting-secrets-for-non-development-environments).

Now continue with the guide underneath.

# 🚀 Getting started with Strapi
Expand Down
22 changes: 22 additions & 0 deletions backend/config/env/production/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// path: ./config/env/production/database.js

const { parse } = require("pg-connection-string");

module.exports = ({ env }) => {
const { host, port, database, user, password } = parse(env("DATABASE_URL"));

return {
connection: {
client: "postgres",
connection: {
host,
port,
database,
user,
password,
ssl: { rejectUnauthorized: false },
},
debug: false,
},
};
};
17 changes: 17 additions & 0 deletions backend/config/env/production/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Path: ./config/env/production/server.js
// starting from Strapi v 4.6.1 server.js has to be the following

module.exports = ({ env }) => ({
proxy: true,
host: "0.0.0.0",
port: process.env.PORT,
url: env("MY_HEROKU_URL"),
app: {
keys: env.array("APP_KEYS"),
},
admin: {
auth: {
secret: env("ADMIN_JWT_SECRET"),
},
},
});
2 changes: 1 addition & 1 deletion backend/config/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
endpoint: "/graphql",
shadowCRUD: true,
playgroundAlways: false,
depthLimit: 7,
depthLimit: 20,
amountLimit: 100,
apolloServer: {
tracing: false,
Expand Down
Loading

0 comments on commit bf4de0c

Please sign in to comment.