Giter VIP home page Giter VIP logo

express-prisma-mongo-starter's Introduction

Express.js + Prisma + MongoDB Starter Template

This is a template for a simple To Do List web app that consists of a REST API and a simple front end UI.

The app uses Express.js as the foundation for serving both the REST API back end and the front end. Prisma is used as the ORM to define the data model and interface to the MongoDB database.

Using this Starter Template

This repo can be used as an Adaptable.io Starter. For instructions on using this repo as a template and deploying to the Adaptable Cloud in just a few clicks, check out the Starter Guide.

Running a local dev environment

All of the following instructions assume you are in the repo root directory.

1. Install Node.js modules

yarn

2. Run MongoDB locally

The app requires a database to store the data for the REST API. You can run a MongoDB cluster on your local development system if you have Docker installed.

To run a MongoDB cluster using Docker:

yarn run mongo-start

To later stop the MongoDB cluster:

WARNING: All data stored in the local cluster will be deleted when the container is stopped. For information on persisting the database data, see adaptable/mongo-replica-set.

yarn run mongo-stop

3. Set DATABASE_URL

The app uses the environment variable DATABASE_URL to connect to your MongoDB instance. Use a .env file to set DATABASE_URL in your local dev environment. The included sample.env file contains the correct DATABASE_URL to connect to the local cluster.

To set DATABASE_URL to connect to your local MongoDB cluster running in Docker, copy the sample.env file to .env:

cp sample.env .env

4. Start the app

yarn run dev

NOTE: By default, the app listens on port 3000. To use a different port, set the PORT environment variable to the desired port number.

5. Connect to your app

Use a web browser to connect to http://localhost:3000

Source Code

REST API (back end)

The Prisma schema (data model) for the REST API can be found in prisma/schema.prisma. The implementation of the /todos REST API endpoint is in src/routes/todos.js.

Web UI (front end)

The layout and static portions of the front end can be found in src/views/index.hbs. The dynamic part of the front end is in public/js/client.js.

Adaptable.io

express-prisma-mongo-starter's People

Contributors

mterrel avatar 3kmfi6hp avatar mvachhar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.