Skip to content

Instantly share code, notes, and snippets.

View AndrejGajdos's full-sized avatar

Andrej Gajdos AndrejGajdos

View GitHub Profile
@AndrejGajdos
AndrejGajdos / launch.json
Created October 24, 2023 07:41
Debugging server side in Next.js
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Next.js",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/next",
"runtimeArgs": ["dev"],
"console": "integratedTerminal",
const corsOptions = {
credentials: true,
};
app.use(cors(corsOptions));
app.use(ratelimit({
db,
duration: 60000,
max: 100,
}));
const passport = require('koa-passport');
app.use(passport.initialize());
app.use(passport.session());
app.use(
session(
{
store: redisStore(),
},
app,
),
);
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router';
import { connect } from 'react-redux';
import { NavLink } from 'react-router-dom';
import get from 'lodash/get';
import ProfilePlaceholder from 'assets/img/profile_placeholder.png';
import { isValidURL } from 'utils/utils';
import { logout, getProfile } from 'actions/access.actions';
import toggleLogin from 'actions/modals.actions';
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import Cookies from 'js-cookie';
import { Redirect } from 'react-router';
import { AsyncHomeView, AsyncAboutView } from 'asyncViews';
export default function Routes() {
return (
<Switch>
import React from 'react';
import Loadable from 'react-loadable';
const Loading = () => (
<div />
);
export const AsyncAboutView = Loadable({
loader: () => import('about/AboutView'),
loading: () => <Loading />,
import axios from 'axios';
import { API_ADDRESS } from 'config';
export function get(path, params) {
const url = `${API_ADDRESS}${path}`;
return axios({
method: 'get',
url,
params,
import Cookies from 'js-cookie';
import * as ActionTypes from '../constants/actionTypes';
const initialState = {
user: {
isAuthenticated: typeof Cookies.get('auth__flow__spa__loggedUserObj') !== 'undefined',
loggedUserObj: Cookies.getJSON('auth__flow__spa__loggedUserObj'),
},
error: null,
};