FaceGallery BS
Pre-reqs
Getting started
- Install dependencies
cd <project_name>
npm install
- Start your mongoDB server (you'll probably want another command prompt)
mongod
- Build and run the project
npm start
rename .env.example
to .env
et ajouter FACEBOOK_ID
et FACEBOOK_SECRET
Navigate to http://localhost:3000
Project Structure
The full folder structure of this app is explained below:
Note! Make sure you have already built the app using
npm run build
Name | Description |
---|---|
.vscode | Contains VS Code specific settings |
dist | Contains the distributable (or output) from your TypeScript build. This is the code you ship |
node_modules | Contains all your npm dependencies |
src | Contains your source code that will be compiled to the dist dir |
src/config | Passport authentication strategies and login middleware. Add other complex config code here |
src/controllers | Controllers define functions that respond to various http requests |
src/models | Models define Mongoose schemas that will be used in storing and retrieving data from MongoDB |
src/public | Static assets that will be used client side |
src/types | Holds .d.ts files not found on DefinitelyTyped. Covered more in this section |
src/server.ts | Entry point to your express app |
test | Contains your tests. Seperate from source because there is a different build process. |
.env | API keys, tokens, passwords, database URI. Clone this, but don't check it in to public repos. |
.travis.yml | Used to configure Travis CI build |
.copyStaticAssets.js | Build script that copies images, fonts, and JS libs to the dist folder |
package.json | File that contains npm dependencies as well as build scripts |
tsconfig.json | Config settings for compiling server code written in TypeScript |
tsconfig.tests.json | Config settings for compiling tests written in TypeScript |
tslint.json | Config settings for TSLint code style checking |
Running the build
Npm Script | Description |
---|---|
start |
Runs full build before starting all watch tasks. Can be invoked with npm start |
build |
Full build. Runs ALL build tasks (build-sass , build-ts , tslint , copy-static-assets ) |
serve |
Runs node on dist/server.js which is the apps entry point |
watch |
Runs all watch tasks (TypeScript, Sass, Node). Use this if you're not touching static assets. |
test |
Runs tests using Jest test runner |
build-ts |
Compiles all source .ts files to .js files in the dist folder |
watch-ts |
Same as build-ts but continuously watches .ts files and re-compiles when needed |
build-sass |
Compiles all .scss files to .css files |
watch-sass |
Same as build-sass but continuously watches .scss files and re-compiles when needed |
tslint |
Runs TSLint on project files |
copy-static-assets |
Calls script that copies JS libs, fonts, and images to dist directory |