Code Monkey home page Code Monkey logo

express-typeorm-starter's Introduction

Starter projekt with Express and Typeorm

This serves as a base for small projects with Express.js and TypeOrm.

Getting started

This is a small project where some things are already set up to get you started. To use it, clone this repo, install NodeJS and run npm install in the project directory. This will install all dependencies and you can start.

The project is written in TypeScript which transpiles to JavaScript in the build directory. To build it the command npm run build can be used.

For a quick development server you can run npm run start. Once the server is started it can be accessed at http://localhost:3000.

Used Frameworks and Libraries

The web server uses Express.js which is based on middlewares. A json middleware is included and already set up so the API can send and receive JSON responses and requests.

To keep things simple SQLite is used as a database. As ORM TypeORM which plays nicely with TypeScript.

Tips

  • With npm run start TS Node is used to directly run the code. Normally you would have to transpile it first (you can do so with npm run build) but TS-Node will transpile files on the fly.
  • Database configuration is done in ormconfig.json and when you run the server with TS Node it will automatically be picked up and used for connection. You can also manually configure the connection directly in the code.
  • If you want to transpile manually and run the transpiled code yourself (for example with node build/index.js) you'll have to provide database configuration otherwise, since the default conifugration points to the directory containing the TypeScript files for entities. See the TypeORM docs for more information.
  • If synchronize: true is set in the TypeORM connection settings the database schema is automatically updated from the entities TypeORM found. More info is found in the TypeORM docs.
  • You can enable schema and query logging in the connection settings. See the TypeORM docs for more information.

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.