Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post('/signin', reqAdminCredentials, (req, res) => {
- const userName = req.body.userName;
- const password = req.body.password;
- res.json(auth.getToken(userName));
- .then((isLoginSuccess) => {
- req.session.user = userName;
- res.json({ loginSuccess: true })
- })
- .catch(e => {
- res.status(500).json({ error: "LOGIN_FAILS" });
- })
- });
- entry: [
- 'webpack/hot/only-dev-server',
- `webpack-dev-server/client?${HOST_URI}`,
- './public/index.js'
- ],
- output: {
- path: __dirname,
- publicPath: '/',
- filename: 'bundle.js'
- },
- devtool: 'source-map',
- module: {
- loaders: [{
- exclude: /node_modules/,
- loader: 'babel',
- query: {
- presets: ['react', 'es2015', 'stage-1']
- }
- },
- { test: /.json$/, loader: 'json' },
- {
- test: /.js?$/,
- exclude: /node_modules/,
- loader: 'babel',
- include: SRC
- },
- ]
- },
- resolve: {
- extensions: ['', '.js', '.jsx']
- },
- devServer: {
- historyApiFallback: true,
- contentBase: './',
- port: 3000
- },
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new webpack.NoErrorsPlugin(),
- // Define the env
- new webpack.DefinePlugin({
- 'process.env': {
- 'NODE_ENV': JSON.stringify(ENV),
- 'SECONDS': JSON.stringify(SECONDS),
- 'QUESTIONCOUNT': JSON.stringify(QUESTIONCOUNT)
- }
- }),
- // Build progress bar
- new webpack.ProgressPlugin(function(percentage, msg) {
- console.log((percentage * 100) + '%', msg);
- })
- ],
- router.get('/', (req, res) => {
- req.session.count = 0;
- res.json(`user:${req.session.user} count:${req.session.count}`);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement