
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Londor is a nice little service based framework on top of express. It's 2 core values
es6
commonjs
experimentalDecorators
to trueemitDecoratorMetadata
to truenpm install londor --save
It should look something like below.
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
},
"exclude": [
"node_modules"
]
}
import { Server } from 'londor'
const server = new Server({
port: 4000
})
server.start()
.then(() => {
console.log("The server is started on port 4000!")
})
.catch((err) => {
console.error(err)
})
A service is just a class
that you can add to a Server
instance.
@Get, @Post, @Put, @Delete
etc...@Param('carId')
or just @Param
decoratorimport { Server, Get, Post, Put, Delete, BaseRoute, Body } from 'londor'
@BaseRoute('/cars')
class CarService {
cars = [{
carId: 1,
name: 'toyota',
}, {
carId: 2,
name: 'ford',
}]
@Get('/all')
getAllCars(){
return this.cars
}
@Post('/')
async addNewCar(@Body body: any) {
this.cars.push(body.car)
return body
}
@Put('/:carId')
async updateCar(@Body body: any) {
this.cars.push(body.car)
return body
}
@Delete('/:carId')
async deleteCar(@Param carId: string) {
for(let car of this.cars) {
if (car.carId === carId) {
this.cars.splice(this.cars.indexOf(car), 1)
}
}
}
}
const server = new Server({
port: 4000
})
server.addService(new CarService())
server.start()
.then(() => {
console.log("The server is started on port 4000!")
})
.catch((err) => {
console.error(err)
})
The server can easily attach express middlewares. Simply use the familiar use
functionality
import * as cors from 'cors'
server.use(cors())
You can add additional middlewares before
import { Get, UseMiddleware } from 'londor'
Serving Static Files is super easy with @ServeStatic
This is simply a wrapper around express.static
API
import { ServeStatic, BaseRoute } from 'londor'
@BaseRoute('/dashboard')
@ServeStatic('/', 'path/to/index.html')
@ServeStatic('/admin', 'path/to/admin.html')
class DashboardService {
// .. more implementation goes here
}
server.addService(new DashboardService())
server.start()
.then(() => {
console.log("The server is started on port 4000!")
console.log("The dashboard is at http://localhost:4000/dashboard")
console.log("The admin panel is at http://localhost:4000/dashboard/admin")
})
.catch((err) => {
console.error(err)
})
After npm install
npm run build
npm run clean
npm run test
npm run lint
npm run watch
.ts
or your test ending in .spec.ts
Launch Program
or Launch Tests
in the debug pane.Launch Program
or Launch Tests
in the debug pane.FAQs
A tiny typescript and express based web framework
We found that londor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.