Skip to content

Commit 3b27192

Browse files
committed
feat(api): add api for editor
1 parent bc4f454 commit 3b27192

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+11690
-0
lines changed

back-end/h5-api/.editorconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[{package.json,*.yml}]
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false

back-end/h5-api/.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.cache
2+
build
3+
**/node_modules/**

back-end/h5-api/.eslintrc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "eslint:recommended",
4+
"env": {
5+
"commonjs": true,
6+
"es6": true,
7+
"node": true,
8+
"browser": false
9+
},
10+
"parserOptions": {
11+
"ecmaFeatures": {
12+
"experimentalObjectRestSpread": true,
13+
"jsx": false
14+
},
15+
"sourceType": "module"
16+
},
17+
"globals": {
18+
"strapi": true
19+
},
20+
"rules": {
21+
"indent": ["error", 2, { "SwitchCase": 1 }],
22+
"linebreak-style": ["error", "unix"],
23+
"no-console": 0,
24+
"quotes": ["error", "single"],
25+
"semi": ["error", "always"]
26+
}
27+
}

back-end/h5-api/.gitignore

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
############################
2+
# OS X
3+
############################
4+
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
.Spotlight-V100
10+
.Trashes
11+
._*
12+
13+
14+
############################
15+
# Linux
16+
############################
17+
18+
*~
19+
20+
21+
############################
22+
# Windows
23+
############################
24+
25+
Thumbs.db
26+
ehthumbs.db
27+
Desktop.ini
28+
$RECYCLE.BIN/
29+
*.cab
30+
*.msi
31+
*.msm
32+
*.msp
33+
34+
35+
############################
36+
# Packages
37+
############################
38+
39+
*.7z
40+
*.csv
41+
*.dat
42+
*.dmg
43+
*.gz
44+
*.iso
45+
*.jar
46+
*.rar
47+
*.tar
48+
*.zip
49+
*.com
50+
*.class
51+
*.dll
52+
*.exe
53+
*.o
54+
*.seed
55+
*.so
56+
*.swo
57+
*.swp
58+
*.swn
59+
*.swm
60+
*.out
61+
*.pid
62+
63+
64+
############################
65+
# Logs and databases
66+
############################
67+
68+
.tmp
69+
*.log
70+
*.sql
71+
*.sqlite
72+
*.sqlite3
73+
74+
75+
############################
76+
# Misc.
77+
############################
78+
79+
*#
80+
ssl
81+
.idea
82+
nbproject
83+
public/uploads/*
84+
!public/uploads/.gitkeep
85+
86+
############################
87+
# Node.js
88+
############################
89+
90+
lib-cov
91+
lcov.info
92+
pids
93+
logs
94+
results
95+
node_modules
96+
.node_history
97+
98+
99+
############################
100+
# Tests
101+
############################
102+
103+
testApp
104+
coverage
105+
106+
############################
107+
# Strapi
108+
############################
109+
110+
exports
111+
.cache
112+
build

back-end/h5-api/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Strapi application
2+
3+
A quick description of your strapi application

back-end/h5-api/api/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"routes": [
3+
{
4+
"method": "GET",
5+
"path": "/works",
6+
"handler": "Work.find",
7+
"config": {
8+
"policies": []
9+
}
10+
},
11+
{
12+
"method": "GET",
13+
"path": "/works/count",
14+
"handler": "Work.count",
15+
"config": {
16+
"policies": []
17+
}
18+
},
19+
{
20+
"method": "GET",
21+
"path": "/works/:id",
22+
"handler": "Work.findOne",
23+
"config": {
24+
"policies": []
25+
}
26+
},
27+
{
28+
"method": "POST",
29+
"path": "/works",
30+
"handler": "Work.create",
31+
"config": {
32+
"policies": []
33+
}
34+
},
35+
{
36+
"method": "PUT",
37+
"path": "/works/:id",
38+
"handler": "Work.update",
39+
"config": {
40+
"policies": []
41+
}
42+
},
43+
{
44+
"method": "DELETE",
45+
"path": "/works/:id",
46+
"handler": "Work.delete",
47+
"config": {
48+
"policies": []
49+
}
50+
}
51+
]
52+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
/**
4+
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/guides/controllers.html#core-controllers)
5+
* to customize this controller
6+
*/
7+
8+
module.exports = {};
+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
'use strict';
2+
3+
/**
4+
* Lifecycle callbacks for the `Work` model.
5+
*/
6+
7+
module.exports = {
8+
// Before saving a value.
9+
// Fired before an `insert` or `update` query.
10+
// beforeSave: async (model, attrs, options) => {},
11+
12+
// After saving a value.
13+
// Fired after an `insert` or `update` query.
14+
// afterSave: async (model, response, options) => {},
15+
16+
// Before fetching a value.
17+
// Fired before a `fetch` operation.
18+
// beforeFetch: async (model, columns, options) => {},
19+
20+
// After fetching a value.
21+
// Fired after a `fetch` operation.
22+
// afterFetch: async (model, response, options) => {},
23+
24+
// Before fetching all values.
25+
// Fired before a `fetchAll` operation.
26+
// beforeFetchAll: async (model, columns, options) => {},
27+
28+
// After fetching all values.
29+
// Fired after a `fetchAll` operation.
30+
// afterFetchAll: async (model, response, options) => {},
31+
32+
// Before creating a value.
33+
// Fired before an `insert` query.
34+
// beforeCreate: async (model, attrs, options) => {},
35+
36+
// After creating a value.
37+
// Fired after an `insert` query.
38+
// afterCreate: async (model, attrs, options) => {},
39+
40+
// Before updating a value.
41+
// Fired before an `update` query.
42+
// beforeUpdate: async (model, attrs, options) => {},
43+
44+
// After updating a value.
45+
// Fired after an `update` query.
46+
// afterUpdate: async (model, attrs, options) => {},
47+
48+
// Before destroying a value.
49+
// Fired before a `delete` query.
50+
// beforeDestroy: async (model, attrs, options) => {},
51+
52+
// After destroying a value.
53+
// Fired after a `delete` query.
54+
// afterDestroy: async (model, attrs, options) => {}
55+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"connection": "default",
3+
"collectionName": "work",
4+
"info": {
5+
"name": "work",
6+
"description": "用户的一个H5作品"
7+
},
8+
"options": {
9+
"increments": true,
10+
"timestamps": [
11+
"created_at",
12+
"updated_at"
13+
],
14+
"comment": ""
15+
},
16+
"attributes": {
17+
"title": {
18+
"required": true,
19+
"type": "string"
20+
},
21+
"description": {
22+
"type": "text"
23+
},
24+
"cover_image_url": {
25+
"type": "string"
26+
},
27+
"is_publish": {
28+
"type": "boolean"
29+
},
30+
"create_time": {
31+
"type": "date"
32+
},
33+
"update_time": {
34+
"type": "date"
35+
},
36+
"pages": {
37+
"type": "json"
38+
}
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
/**
4+
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/guides/services.html#core-services)
5+
* to customize this service
6+
*/
7+
8+
module.exports = {};
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"favicon": {
3+
"path": "favicon.ico",
4+
"maxAge": 86400000
5+
},
6+
"public": {
7+
"path": "./public",
8+
"maxAge": 60000
9+
}
10+
}

back-end/h5-api/config/custom.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"myCustomConfiguration": "This configuration is accessible through strapi.config.myCustomConfiguration"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"myCustomConfiguration": "This configuration is accessible through strapi.config.environments.development.myCustomConfiguration"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"defaultConnection": "default",
3+
"connections": {
4+
"default": {
5+
"connector": "strapi-hook-bookshelf",
6+
"settings": {
7+
"client": "sqlite",
8+
"filename": ".tmp/data.db"
9+
},
10+
"options": {
11+
"useNullAsDefault": true
12+
}
13+
}
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"session": {
3+
"enabled": true,
4+
"client": "cookie",
5+
"key": "strapi.sid",
6+
"prefix": "strapi:sess:",
7+
"secretKeys": ["mySecretKey1", "mySecretKey2"],
8+
"httpOnly": true,
9+
"maxAge": 86400000,
10+
"overwrite": true,
11+
"signed": false,
12+
"rolling": false
13+
},
14+
"logger": {
15+
"level": "debug",
16+
"exposeInContext": true,
17+
"requests": true
18+
},
19+
"parser": {
20+
"enabled": true,
21+
"multipart": true
22+
}
23+
}

0 commit comments

Comments
 (0)