Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b02ea3

Browse files
committed
add studio
1 parent07781d7 commit8b02ea3

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

‎build.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
const{ execSync}=require('child_process');
4+
5+
constopts={
6+
apiKey:process.env.MONGOOSE_STUDIO_API_KEY
7+
};
8+
console.log('Creating Mongoose studio',opts);
9+
require('@mongoosejs/studio/frontend')(`/.netlify/functions/studio`,true,opts).then(()=>{
10+
execSync(`
11+
mkdir -p ./public/studio
12+
cp -r ./node_modules/@mongoosejs/studio/frontend/public/* ./public/studio/
13+
`);
14+
});

‎netlify/functions/studio.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
constmongoose=require('mongoose');
4+
5+
require('../../src/movies-demo/movies.model');
6+
7+
consthandler=require('@mongoosejs/studio/backend/netlify')({
8+
apiKey:process.env.MONGOOSE_STUDIO_API_KEY
9+
}).handler;
10+
11+
letconn=null;
12+
13+
module.exports={
14+
handler:asyncfunctionstudioHandler(params){
15+
if(conn==null){
16+
conn=awaitmongoose.connect(process.env.MONGODB_CONNECTION_STRING,{serverSelectionTimeoutMS:3000});
17+
}
18+
19+
returnhandler.apply(null,arguments);
20+
}
21+
};

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"name":"studio.mongoosejs.io",
33
"dependencies": {
4+
"@mongoosejs/studio":"0.0.77",
45
"tailwindcss":"3.x"
56
},
67
"devDependencies": {
78
"serve":"14.2.4"
89
},
910
"scripts": {
11+
"build":"node ./build",
1012
"postinstall":"npm run tailwind",
1113
"start":"serve ./public",
1214
"tailwind":"tailwindcss -o ./public/tw.css",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp