File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const { execSync } = require ( 'child_process' ) ;
4+
5+ const opts = {
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+ } ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const mongoose = require ( 'mongoose' ) ;
4+
5+ require ( '../../src/movies-demo/movies.model' ) ;
6+
7+ const handler = require ( '@mongoosejs/studio/backend/netlify' ) ( {
8+ apiKey : process . env . MONGOOSE_STUDIO_API_KEY
9+ } ) . handler ;
10+
11+ let conn = null ;
12+
13+ module . exports = {
14+ handler : async function studioHandler ( params ) {
15+ if ( conn == null ) {
16+ conn = await mongoose . connect ( process . env . MONGODB_CONNECTION_STRING , { serverSelectionTimeoutMS : 3000 } ) ;
17+ }
18+
19+ return handler . apply ( null , arguments ) ;
20+ }
21+ } ;
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments