Skip to content

A demo app / code sample allowing users to create, browse, and take surveys!

Notifications You must be signed in to change notification settings

mrrts/survey-town

Repository files navigation

Description

Survey Town is a demo portfolio app that allows users to browse, create, and take surveys. The server is built on the Nest framework, featuring a Controller-Service-Repository pattern and Dependency Injection, and the client is a React app, using Redux Toolkit, Redux Observable, and Sass. Both client and server are written entirely in Typescript.

Installation

Server

$ npm install

Client

$ cd client
$ npm install

Configuration

Server

Create a git-ignored file at the project root named .env that looks like the following:

# Supply a MongoDb connection string
DB_URL=mongodb+srv://USERNAME:[email protected]/DB_NAME?retryWrites=true&w=majority

# Generate a strong random value 
AUTH_SECRET=39834oidsknkvnweikfjf4i4i$%$dfkdksj

# use 1 in production
USE_SECURE_SESSION=0

# Can be whatever you want
SESSION_COOKIE_NAME=connect.sid

FRONT_END_ORIGIN=http://localhost:3001

NODE_ENV=development

Client

Create a git-ignored file in the client folder named /client/.env that looks like the following:

REACT_APP_BASE_API_URL=http://localhost:3000/api
REACT_APP_ENV=development

Running the server

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Server Tests

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

Running the client

Because the server will already be running on port 3000 by default, the client start command will give you the option to run on a different port (3001). Choose Y (yes) for this option.

# development
$ npm start

# production build
$ npm run build

For development, go to http://localhost:3001 to view the app.

Client tests

# unit tests
$ npm test

# test coverage
$ npm run test:coverage

About

A demo app / code sample allowing users to create, browse, and take surveys!

Topics

Resources

Stars

Watchers

Forks

Languages