Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 1.38 KB

backend.md

File metadata and controls

25 lines (14 loc) · 1.38 KB

Backend

The Meirim backend is written in Javascript (Node.js, we currently use release 14.x), using Express and Bookshelf, with Knex used for database migrations. We currently use MySQL as our database.

The backend code lives under the server folder.

Executing

To run the code after resolving dependencies and configuring as explained in the main readme, use:

$ npm start

The service will then be available on port 3001 (configurable using environment variable "PORT", eg. PORT=1337 npm start).

Caveats

Static app and routes

You may have noticed that our main serve script used for production (npm run serve) creates an Express instance and binds two apps to it - the backend app (from apiApp.js) under the '/api' path and a static app (from staticApp.js) under the root '/' path.

This is used in production to enable a little bit of server-side rendering for rendering our Open Graph tags.

Basically, the static app simply points to the static website files (built using react-scripts) from the client package which can also be served as-is (but will contain unrendered template tags), and registers a Handlebars templating engine which will be used to render html files served under this app.