Angular v4 starter using Typescript and Webpack
IE / Edge | Firefox | Chrome | Safari | Opera | |
---|---|---|---|---|---|
IE10, IE11, Edge | last 2 versions | last 2 versions | last 2 versions | - | - |
Complete starter for Angular 2 using Webpack works with JWT Including a login, about, 404, commons header and footer components in order to create a generic skeleton
1/
# clone the repo
git clone ...
# change directory to your app
# install the dependencies with npm
$ npm install
# start the server
$ npm run start
2/ Launch a web browser and go http://localhost:8080
3/ Test End to End with Protractor, Jasmine framework and Selenium for Chrome only.
# install Selenium
# From a new term tab, launch chrome webdrivers
./node_modules/protractor/bin/webdriver-manager start
# From an other term tab, launch npm start.
# From an other term tab
npm run e2e
4/ Using webpack dev server with a proxy url for your API routes. Just use /api in order to by pass with the webpack proxy.
5/ CSS
import { isEmpty } from 'lodash';
# After that u can just call isEmpty fnc
if (isEmpty(your_variable)) { ... }
If you want keep it, you have to get an API with JWT. Example with Nodejs
const routes: Routes = [
{ path: 'about', component: AboutComponent, canActivate: [ AuthGuard ] } # add AuthGuard to your route.
];
git clone the repo.
# from a term tab, do:
npm install
npm start
The ECRM will be available and you will be able to login and logout to the web app.
Webpack dev server enables a proxy url. Look at webpackconfig.js
proxy: {
"/api": {
target: "http://localhost:3000", // to be changed by the good api url
pathRewrite: {"^/api" : ""}
}
}
To build your application, run:
npm run build
You can now go to /dist and deploy that with Nginx for example to your server!