Advertisement
Guest User

Untitled

a guest
Nov 30th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. router.post('/signin', reqAdminCredentials, (req, res) => {
  2. const userName = req.body.userName;
  3. const password = req.body.password;
  4.  
  5. res.json(auth.getToken(userName));
  6. .then((isLoginSuccess) => {
  7. req.session.user = userName;
  8. res.json({ loginSuccess: true })
  9. })
  10. .catch(e => {
  11. res.status(500).json({ error: "LOGIN_FAILS" });
  12. })
  13. });
  14.  
  15. entry: [
  16. 'webpack/hot/only-dev-server',
  17. `webpack-dev-server/client?${HOST_URI}`,
  18. './public/index.js'
  19. ],
  20. output: {
  21. path: __dirname,
  22. publicPath: '/',
  23. filename: 'bundle.js'
  24. },
  25. devtool: 'source-map',
  26. module: {
  27. loaders: [{
  28. exclude: /node_modules/,
  29. loader: 'babel',
  30. query: {
  31. presets: ['react', 'es2015', 'stage-1']
  32. }
  33. },
  34. { test: /.json$/, loader: 'json' },
  35. {
  36. test: /.js?$/,
  37. exclude: /node_modules/,
  38. loader: 'babel',
  39. include: SRC
  40. },
  41. ]
  42. },
  43. resolve: {
  44. extensions: ['', '.js', '.jsx']
  45. },
  46. devServer: {
  47. historyApiFallback: true,
  48. contentBase: './',
  49. port: 3000
  50. },
  51. plugins: [
  52. new webpack.HotModuleReplacementPlugin(),
  53. new webpack.NoErrorsPlugin(),
  54. // Define the env
  55. new webpack.DefinePlugin({
  56. 'process.env': {
  57. 'NODE_ENV': JSON.stringify(ENV),
  58. 'SECONDS': JSON.stringify(SECONDS),
  59. 'QUESTIONCOUNT': JSON.stringify(QUESTIONCOUNT)
  60.  
  61. }
  62. }),
  63. // Build progress bar
  64. new webpack.ProgressPlugin(function(percentage, msg) {
  65. console.log((percentage * 100) + '%', msg);
  66. })
  67. ],
  68.  
  69. router.get('/', (req, res) => {
  70. req.session.count = 0;
  71. res.json(`user:${req.session.user} count:${req.session.count}`);
  72. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement