Skip to content

BashPrime/metroidprime.run

Repository files navigation

metroidprime.run

Code and database scaffolding for https://metroidprime.run.

About

This web application is powered by Angular, TypeScript, Node.js, Express.js, and Knex.js.

This app uses PostgreSQL 10 for the database. While other databases can technically be used due this project using Knex, this project assumes you are using a PostgreSQL server.

Install

You will need to install Node.js to download the project dependencies using npm. Once you have Node installed, run the following commands:

Run the following command to create a new config file for the application:

npm run generate:config

You will need to configure your database connection settings in /src/server/config.json. For example:

database: {
  host: 'localhost',
  port: 5432,
  user: 'foo',
  password: 'bar',
  database: 'metroidprimerun'
}

After configuring your server, run the following command to scaffold the database:

npm run initdb

Running the Application

Development

To start the Angular client with hot reloading support, run the following command, then open http://localhost:4200 in your browser:

(NOTE: You will need to change the port in proxy.conf.json if you change the server port in config.json)

npm run client

To start the Express server with hot reloading support, run the following command:

npm run server:dev

Production

To build the application for production use, run the following command:

npm run build:prod

This will build both the Angular client and Node server for production use, and output both bundles to the /dist folder.

To run the application in production, run the following command:

npm run server:prod