Giter Club home page Giter Club logo

companieshouse.node-web-starter's Introduction

Web Starter NodeJS

Overview

The aim of this template is to give you a head start in setting up a new web application for Companies House.

The template uses Express, TypeScript and the GovUK Frontend toolkit to set up a simple example of a web application that runs on NodeJS.

You can create a new project from this template by clicking the Use this template button.

Contents

Quick start

If you are familiar with NodeJS development and already have it installed, simply run the init make task

make init

And then start the application

npm start

Then go to http://localhost:3000.

Prerequisites

You are going to need a few things to begin. Firstly, NodeJS. There are a few ways to install it.

Node version manager allows you to install multiple versions side by side on the host machine.

Once you have that installed, you will need to install the dependencies (locally) and GulpJS (globally). This task runner is used to compile the Sass used in the GovUK Frontend.

npm i
npm install gulp-cli -g

Running the server

There are two ways to run the server in development. You run it in normal mode;

npm start

Or, automatically reload the server once you make changes to source code;

npm start:watch

Static assets

Sass is used to compile the css from GovUK Frontend. The static gulp task will build the necessary files and output them to the dist folder.

gulp static

During development, static assets are served from this folder using the url prefix /static.

Compiling the application

TypeScript compiles down the JavaScript code that eventually gets run via NodeJS. The build npm task will write the JavaScript to the dist folder.

npm run build

It is this code that gets run in production.

Linting

TSLint is used to perform static analysis on code style.

npm run lint

Testing

Tests can be found in the directory src/test. The framework used is Jest along with Supertest to dispatch handlers that can have assertions made against the responses. Execute the following to run the tests;

npm t

companieshouse.node-web-starter's People

Contributors

damiandunajski avatar dependabot[bot] avatar kevbradwick 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.