# exprasma ## For prisma Notes: Uses docker 1. Install prisma `npm install prisma` 2. Create service directory (The name will be passed by command line argument) `mkdir hello-world` `cd hello-world` 3. Use templates of docker-compose TODO: Change to be able to use PostgreSQL or MongoDB. `cp ../docker-compose.yml .` 4. Launch `docker-compose up -d` 5. Configure prisma API `npx prisma init --endpoint http://localhost:4466` 6. Deploy prisma datamodel `prisma deploy` 7. Generate prisma client Append the following lines to the end of your `prisma.yml` ``` generate: - generator: javascript-client output: ./generated/prisma-client/ ``` 8. Generate `prisma generate` 9 Prepare Node Application `touch index.js` `npm init -y` `npm install --save prisma-client-lib` I think below is not appropriate ```index.js const { prisma } = require('./generated/prisma-client') // A `main` function so that we can use async/await async function main() { // Create a new user called `Alice` const newUser = await prisma.createUser({ name: 'Alice' }) console.log(`Created new user: ${newUser.name} (ID: ${newUser.id})`) // Read all users from the database and print them to the console const allUsers = await prisma.users() console.log(allUsers) } main().catch(e => console.error(e)) ``` ## For Expo 1. Install expo `npm install expo-cli` 2. Init Expo (The name will be passed by command line argument) `npx expo init my-new-project` `cd my-new-project` 3. Copy template js files `cp ../index.js .` 4. Start Expo `npx expo start`