LogoLogo
CS CONSOLECOMMUNITYDOCS
  • What is code.store?
  • Our vision
  • How it works?
  • Getting started
    • Quick Start
      • Core concepts
      • Quick Start with CLI
      • Quick Start with Web Interface
    • FUNDAMENTALS
      • Services
        • GraphQL
        • REST
        • Configuration
        • Environment Variables
      • Environments
      • Projects
      • Versioning
      • Access and Authorization
      • Secret management
      • Data management
        • Import and Export
      • Generation
        • Models
        • Handlers
        • Resolvers
        • REST
        • Middlewares
      • Logging
      • Microservices
        • Communication
    • RECIPES
      • TypeScript
        • Custom .tslint
      • Basic authentication
      • Setup a local database with your service
      • GraphQL
    • Tutorials
      • Auth0 authentication
      • Metabase integration
      • Database manipulations
        • External database: MongoDB
        • External database: DynamoDB
      • Wrapping an NPM package with GraphQL: a chess server
    • FAQ
  • Command Line Interface
    • Getting started
    • Commands
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Getting started
  2. RECIPES

Setup a local database with your service

To help you with local development of you services you'll need a local Postgre database.

PreviousBasic authenticationNextGraphQL

Last updated 4 years ago

Was this helpful?

You know that we care about your time, so we created a local launcher for your services. But you also know that your services have a local database to store your objects. Let's setup a local Postgre database.

This tutorial covers postgre setup for mac. Follow instruction for other OS.

I love working with their simplest version: postgreapp. Go

Launch the application. You have your local postgre database. You should see a small icon of postgre in your menu top bar.

Now you can go in any of your services folders and and edit codestore.yaml file. You should see something like that :

serviceId: 145
localConfiguration:
  database:
    port: 5432
    database: database
    password: password
    username: username
    host: localhost
  application:
    port: 3000

Change the database name, password, and username to the ones from

To test your connection, nothing more simple : execute in the root folder of your service cs dev command. You should see something like that :

cs dev
2020-09-11T10:10:00.638Z [NPM] Installing dependencies
2020-09-11T10:10:05.359Z [TypeScript] Compiling typescript code
2020-09-11T10:10:13.745Z [GraphQL] Validating schema
2020-09-11T10:10:13.767Z [GraphQL] Validating queries and mutations
2020-09-11T10:10:17.168Z [INFO] Starting development server
2020-09-11T10:10:17.168Z [Bootstrap] Start bootstrapping the application
2020-09-11T10:10:17.168Z [Database] Connecting to database
2020-09-11T10:10:17.316Z [Database] Successfully connected
2020-09-11T10:10:17.441Z [Database] Migrations ran
2020-09-11T10:10:17.443Z [GqlLoader] Loaded queries: load
2020-09-11T10:10:17.462Z [Bootstrap] Graphql is available on: http://localhost:3000/graphql

postgre site
there and download it.
postgre configuration.