1.0.21 • Published 4 months ago

nextjs-vip v1.0.21

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

nextjs-vip

Simple and streamlined, built as a helper library for the Nextjs library

The library is under development, and if there are any problems or comments, please submit them on github issues

npm i nextjs-vip

More in the documentation

Project structure

API

This library was built solely for use in API Routes because it is built to improve developer experience and bring the express.js code structure to nextjs API Routes. You can write them within API Routes files

syntx

let app = new API(req, res) 

app.get(auth: Boolean ,callback: fun)
// or
app.get(callback: fun)

example

import API from "nextjs-vip"

export default async function API_Send(req, res, next) {

    let app = new API(req, res)
    app.get(async () => {
        // send data  
        // format JSON
        app.Send(data)
    })
}
name methodsyntx
getget(auth? ,callback)
postpost(auth? ,callback)
putput(auth? ,callback)
deletedelete(auth? ,callback)
patchpatch(auth? ,callback)
allall(auth? ,callback)

sitemap

Create a site map automatically

syntx

// data example
let data =[
    {url:"http://example.com/132",lastmod:"2023-11-4"},
    {url:"http://example.com/131",lastmod:"2023-11-3"}
]
sitemap(res, data)

example

// file: sitemap.xml.js

// imports
import sitemap from "nextjs-vip/sitemap"

export async function getServerSideProps({ res }) {
    const request = await fetch(process.env.NEXT_PUBLIC_API)
    const data = await request.json()

    // generate sitemap.xml
    sitemap(res, data)

    return { props: {} }
} 

export default function s() { }
1.0.21

4 months ago

1.0.20

4 months ago

1.0.19

5 months ago

1.0.18

5 months ago

1.0.17

6 months ago

1.0.16

6 months ago

1.0.15

6 months ago

1.0.14

6 months ago

1.0.13

6 months ago

1.0.12

6 months ago

1.0.11

6 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago