mirror of
https://github.com/SrIzan10/starters.git
synced 2026-05-01 11:05:16 +00:00
add strapi example (#108)
* add strapi example * add missing packages * update README
This commit is contained in:
16
examples/strapi/.editorconfig
Normal file
16
examples/strapi/.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[{package.json,*.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
3
examples/strapi/.eslintignore
Normal file
3
examples/strapi/.eslintignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.cache
|
||||
build
|
||||
**/node_modules/**
|
||||
27
examples/strapi/.eslintrc
Normal file
27
examples/strapi/.eslintrc
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": false
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
"jsx": false
|
||||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"globals": {
|
||||
"strapi": true
|
||||
},
|
||||
"rules": {
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"no-console": 0,
|
||||
"quotes": ["error", "single"],
|
||||
"semi": ["error", "always"]
|
||||
}
|
||||
}
|
||||
114
examples/strapi/.gitignore
vendored
Normal file
114
examples/strapi/.gitignore
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.idea
|
||||
nbproject
|
||||
public/uploads/*
|
||||
!public/uploads/.gitkeep
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
testApp
|
||||
coverage
|
||||
|
||||
############################
|
||||
# Strapi
|
||||
############################
|
||||
|
||||
.env
|
||||
license.txt
|
||||
exports
|
||||
*.cache
|
||||
build
|
||||
.strapi-updater.json
|
||||
30
examples/strapi/README.md
Normal file
30
examples/strapi/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: Strapi
|
||||
description: A self-hosted version of Strapie using a Postgres database
|
||||
tags:
|
||||
- strapi
|
||||
- postgres
|
||||
- cms
|
||||
---
|
||||
|
||||
# Strapi example
|
||||
|
||||
This example deploys self-hosted version of [Strapi](https://strapi.io/). Internally it uses a MySQL database to store the data.
|
||||
|
||||
[](https://railway.app/new/template?template=https%3A%2F%2Fgithub.com%2Frailwayapp%2Fexamples%2Ftree%2Fmaster%2Fexamples%2Fstrapi&plugins=postgresql&envs=ADMIN_JWT_SECRET%2CCLOUDINARY_NAME%2CCLOUDINARY_KEY%2CCLOUDINARY_SECRET&optionalEnvs=CLOUDINARY_NAME%2CCLOUDINARY_KEY%2CCLOUDINARY_SECRET&ADMIN_JWT_SECRETDesc=Secret+used+to+encode+JWT+tokens)
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- Strapi
|
||||
- Postgres
|
||||
|
||||
## 💁♀️ How to use
|
||||
|
||||
- Click the Railway button 👆
|
||||
- Add the environment variables
|
||||
- If you do not add the Cloudinary related environment variables, your images/files will not be persisted between deploys.
|
||||
|
||||
## 📝 Notes
|
||||
|
||||
- After your app is deployed, visit the `/admin` endpoint to create your admin user.
|
||||
- Railway's filesystem is ephemeral which is why any changes to the filesystem are not persisted between deploys. This is why, this example uses Cloudinary for storage.
|
||||
0
examples/strapi/api/.gitkeep
Normal file
0
examples/strapi/api/.gitkeep
Normal file
19
examples/strapi/config/database.js
Normal file
19
examples/strapi/config/database.js
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = ({ env }) => ({
|
||||
defaultConnection: "default",
|
||||
connections: {
|
||||
default: {
|
||||
connector: "bookshelf",
|
||||
settings: {
|
||||
client: "postgres",
|
||||
host: env("PGHOST", "localhost"),
|
||||
port: env.int("PGPORT", 5432),
|
||||
database: env("PGDATABASE", "strapi"),
|
||||
username: env("PGUSER", "strapi"),
|
||||
password: env("PGPASSWORD", "strapi"),
|
||||
schema: env("DATABASE_SCHEMA", "public"), // Not Required
|
||||
ssl: false,
|
||||
},
|
||||
options: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
13
examples/strapi/config/functions/bootstrap.js
vendored
Normal file
13
examples/strapi/config/functions/bootstrap.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#bootstrap
|
||||
*/
|
||||
|
||||
module.exports = () => {};
|
||||
21
examples/strapi/config/functions/cron.js
Normal file
21
examples/strapi/config/functions/cron.js
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Cron config that gives you an opportunity
|
||||
* to run scheduled jobs.
|
||||
*
|
||||
* The cron format consists of:
|
||||
* [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK]
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#cron-tasks
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Simple example.
|
||||
* Every monday at 1am.
|
||||
*/
|
||||
// '0 1 * * 1': () => {
|
||||
//
|
||||
// }
|
||||
};
|
||||
5
examples/strapi/config/functions/responses/404.js
Normal file
5
examples/strapi/config/functions/responses/404.js
Normal file
@@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = async (/* ctx */) => {
|
||||
// return ctx.notFound('My custom message 404');
|
||||
};
|
||||
10
examples/strapi/config/plugins.js
Normal file
10
examples/strapi/config/plugins.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = ({ env }) => ({
|
||||
upload: {
|
||||
provider: "cloudinary",
|
||||
providerOptions: {
|
||||
cloud_name: env("CLOUDINARY_NAME"),
|
||||
api_key: env("CLOUDINARY_KEY"),
|
||||
api_secret: env("CLOUDINARY_SECRET"),
|
||||
},
|
||||
},
|
||||
});
|
||||
9
examples/strapi/config/server.js
Normal file
9
examples/strapi/config/server.js
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = ({ env }) => ({
|
||||
host: env("HOST", "0.0.0.0"),
|
||||
port: env.int("PORT", 1337),
|
||||
admin: {
|
||||
auth: {
|
||||
secret: env("ADMIN_JWT_SECRET"),
|
||||
},
|
||||
},
|
||||
});
|
||||
0
examples/strapi/extensions/.gitkeep
Normal file
0
examples/strapi/extensions/.gitkeep
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
jwtSecret: process.env.JWT_SECRET || '89fdff6d-024c-4d9e-bab1-5288460e4a34'
|
||||
};
|
||||
BIN
examples/strapi/favicon.ico
Normal file
BIN
examples/strapi/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
39
examples/strapi/package.json
Normal file
39
examples/strapi/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "strapi",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
"start": "strapi start",
|
||||
"build": "strapi build",
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"knex": "0.21.18",
|
||||
"pg": "^8.6.0",
|
||||
"strapi": "3.6.2",
|
||||
"strapi-admin": "3.6.2",
|
||||
"strapi-connector-bookshelf": "3.6.2",
|
||||
"strapi-plugin-content-manager": "3.6.2",
|
||||
"strapi-plugin-content-type-builder": "3.6.2",
|
||||
"strapi-plugin-email": "3.6.2",
|
||||
"strapi-plugin-i18n": "3.6.2",
|
||||
"strapi-plugin-upload": "3.6.2",
|
||||
"strapi-plugin-users-permissions": "3.6.2",
|
||||
"strapi-provider-upload-cloudinary": "^3.6.2",
|
||||
"strapi-utils": "3.6.2"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "4429591a-1258-4c86-bb9d-98a9dbd0eb1d"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.16.0 <=14.x.x",
|
||||
"npm": "^6.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
3
examples/strapi/public/robots.txt
Normal file
3
examples/strapi/public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
|
||||
# User-Agent: *
|
||||
# Disallow: /
|
||||
0
examples/strapi/public/uploads/.gitkeep
Normal file
0
examples/strapi/public/uploads/.gitkeep
Normal file
10749
examples/strapi/yarn.lock
Normal file
10749
examples/strapi/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user